[英]How to define an XML element containing forward slash (/) in XSD?
我的Soap请求中有一个元素,如下所示。
<Destination>abc/xyz</Destination>
XML架构验证失败。 如何在XSD中定义它?
我定义如下,这似乎是不正确的:
<xs:element name="Destination" type="Destination" minOccurs="1"/>
<xs:simpleType name="Destination">
<xs:restriction base="xs:string">
<!-- <xs:pattern value="*/*"/> -->
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
您可以在/
之前和之后使用.*/.*
表示零个或多个字符。
<xs:element name="Destination">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value=".*/.*"/>
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.