xsd - Recursion in an XML schema? -


i need create xml schema validates tree structure of xml document. don't know occurrences or depth level of tree.

xml example:

<?xml version="1.0" encoding="utf-8"?> <node>   <attribute/>   <node>     <attribute/>     <node/>         </node> </node>  

which best way validate it? recursion?

if need recursive type declaration, here example might help:

<xs:schema id="xmlschema1"     targetnamespace="http://tempuri.org/xmlschema1.xsd"     elementformdefault="qualified"     xmlns="http://tempuri.org/xmlschema1.xsd"     xmlns:mstns="http://tempuri.org/xmlschema1.xsd"     xmlns:xs="http://www.w3.org/2001/xmlschema" >   <xs:element name="node" type="nodetype"></xs:element>    <xs:complextype name="nodetype">         <xs:sequence minoccurs="0" maxoccurs="unbounded">       <xs:element name="node" type="nodetype"></xs:element>     </xs:sequence>   </xs:complextype>  </xs:schema> 

as can see, defines recursive schema 1 node named "node" can deep desired.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -