我在下面得到了一个特定的 xml 数据
<l7:ApiPlans xmlns:l7="http://ns.xcompany.com/2012/04/api-management">
<l7:ApiPlan>
<l7:PlanPolicy>
<wsp:Policy xmlns:L7p="http://www.xcompany.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:All wsp:Usage="Required">
<wsp:All wsp:Usage="Required">
...... some other welformed xml
</wsp:All>
</wsp:All>
</wsp:Policy>
</l7:PlanPolicy>
</l7:ApiPlan>
</l7:ApiPlans>
我需要编写一个 XSD(如果可能)来验证 PlanPolicy 以
<wsp:Policy xmlns:L7p="http://www.xcompany.com/ws/policy"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:All wsp:Usage="Required">
<wsp:All wsp:Usage="Required">
并以
</wsp:All>
</wsp:All>
</wsp:Policy>
到目前为止,我有这个,
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://ns.xcompany.com/2012/04/api-management" xmlns:l7="http://ns.xcompany.com/2012/04/api-management">
<xs:element name="ApiPlans">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="l7:ApiPlan"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ApiPlan">
<xs:complexType>
<xs:sequence>
<xs:element ref="l7:PlanPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PlanPolicy" type="policyDataType"/>
<simpleType name="policyDataType">
<restriction base="xs:string">
<minLength value="1"></minLength>
<pattern value="(<).*(>).*(<).*(>)"></pattern>
</restriction>
</simpleType>
</xs:schema>
那可能吗?作为一个附带问题,您如何在模式中定义:新行(CR/LF)、制表符和引号。
提前致谢