This is what I have in my schema section of my WSDL to specify the field has to be comparison operators
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="<|>|<=|>开发者_运维技巧;=|="/>
</xsd:restriction>
</xsd:simpleType>
SoapUI complains about this part of the WSDL, I tried to set the value to something with non special characters and the WSDL is valid. So I tried to replace that whole long string to be value=">gt;" and it valid but value="<lt;" is not valid, and value=">" is also not valid. My question is, why does the WSDL validation need > to be double escaped?
The main question is, how to provide a valid less than side within the pattern value.
This might actually be a bug in SoapUI. I tried using the following schema and XML with Apache Xalan (in Java):
Schema:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.foo.com/"
xmlns:tns="http://www.foo.com/"
elementFormDefault="qualified">
<element name="foo">
<simpleType>
<restriction base="string">
<pattern value="<|>|<=|>=|="/>
</restriction>
</simpleType>
</element>
</schema>
Sample XML:
<foo xmlns='http://www.foo.com/'>></foo>
and it validates fine. When I try this instead:
<foo xmlns='http://www.foo.com/'>abc</foo>
I get the following error, as expected: cvc-pattern-valid: Value 'abc' is not facet-valid with respect to pattern '<|>|<=|>=|=' for type '#AnonType_foo'.
My recommendation is to try using an enum instead. For example:
<simpleType>
<restriction base="string">
<enumeration value="<" />
<enumeration value=">" />
<enumeration value="<=" />
<enumeration value=">=" />
<enumeration value="=" />
</restriction>
</simpleType>
And see if SoapUI likes this better. Hope this helps!
I think I solved my own problem, why would you define in your schema that one of the allowable value is
<xsd:restriction base="xsd:string">
<xsd:pattern value="=|&gt;|&gt;=|&lt;|&lt;=|&lt;&gt;|[Ii][Nn]|[Nn][Oo][Tt] [Ii][Nn]|[Ll][Ii][Kk][Ee]"/>
</xsd:restriction>
精彩评论