xml - Is there a wildcard for elements in XMLSchema validation? -
my xml file consists of general part, want validate, , special part, validated later (using different xsd file checks general part again ok since not change).
how can tell xmlschema check element generalpart , not element specialpart? also, name specialpart should interchangible if possible. i'd replace <xs:element name="specialpart" minoccurs="0" maxoccurs="1">
<xs:anything/>
...
<?xml version="1.0" encoding="iso-8859-1"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <xs:element name="mymodule"> <xs:complextype> <xs:sequence> <!-- general part --> <xs:element name="generalpart" minoccurs="0" maxoccurs="1"> <xs:complextype> <xs:sequence> <xs:element name="version" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:element> <!-- special part. --> <xs:element name="specialpart" minoccurs="0" maxoccurs="1"> </xs:sequence> </xs:complextype> </xs:element> </xs:schema>
there any
element:
<?xml version="1.0" encoding="iso-8859-1"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <xs:element name="mymodule"> <xs:complextype> <xs:sequence> <!-- general part --> <xs:element name="generalpart" minoccurs="0" maxoccurs="1"> <xs:complextype> <xs:sequence> <xs:element name="version" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:element> <xs:any minoccurs="0" maxoccurs="1" namespace="##any" processcontents="skip"/> </xs:sequence> </xs:complextype> </xs:element> </xs:schema>
Comments
Post a Comment