1

这就是我在 WSDL 的模式部分中指定的字段必须是比较运算符

                <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                            <xsd:pattern value="&lt;|&gt;|&lt;=|&gt;=|="/>
                        </xsd:restriction>
                </xsd:simpleType>

SoapUI 抱怨这部分 WSDL,我尝试将值设置为具有非特殊字符的值,并且 WSDL 有效。所以我试图将整个长字符串替换为 value=">gt;" 它有效但 value="<lt;" 无效,并且 value=">" 也无效。我的问题是,为什么 WSDL 验证需要 > 进行双重转义?

主要问题是,如何在模式值内提供有效的小于边。

4

2 回答 2

0

这实际上可能是 SoapUI 中的一个错误。我尝试将以下模式和 XML 与 Apache Xalan(Java 中)一起使用:

架构:

<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="&lt;|&gt;|&lt;=|&gt;=|="/>
      </restriction>
    </simpleType>
  </element>

</schema>

示例 XML:

<foo xmlns='http://www.foo.com/'>&gt;</foo>

它验证得很好。当我尝试这样做时:

<foo xmlns='http://www.foo.com/'>abc</foo>

正如预期的那样,我收到以下错误: cvc-pattern-valid: Value 'abc' is not facet-valid with respect to pattern '<|>|<=|>=|=' for type '#AnonType_foo'.

我的建议是尝试使用枚举。例如:

<simpleType>
  <restriction base="string">
    <enumeration value="&lt;" />
    <enumeration value="&gt;" />
    <enumeration value="&lt;=" />
    <enumeration value="&gt;=" />
    <enumeration value="=" />
  </restriction>
</simpleType>

看看 SoapUI 是否更喜欢这个。希望这可以帮助!

于 2010-05-25T22:49:12.517 回答
0

我想我解决了我自己的问题,你为什么要在你的模式中定义一个允许的值是

                        <xsd:restriction base="xsd:string">
                            <xsd:pattern value="=|&amp;gt;|&amp;gt;=|&amp;lt;|&amp;lt;=|&amp;lt;&amp;gt;|[Ii][Nn]|[Nn][Oo][Tt] [Ii][Nn]|[Ll][Ii][Kk][Ee]"/>
                        </xsd:restriction>
于 2010-05-26T15:49:01.000 回答