xsd - Cannot resolve the name X to an element declaration component in a recursive xml schema -


i'm beginning working xml schemas. i'm creating simple schema , don't understand why error while trying implement simple recursive element. i'm sure it's totally trivial.

here following error: e [xerces] src-resolve: cannot resolve name 'node' a(n) 'element declaration' component.

<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified">     <xs:element name="root">         <xs:complextype>             <xs:sequence>                 <xs:element name="node">                     <xs:complextype>                         <xs:sequence>                             <xs:element ref="node" />                         </xs:sequence>                     </xs:complextype>                 </xs:element>             </xs:sequence>         </xs:complextype>     </xs:element> </xs:schema> 

and here, not having root element, don't error...

<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified">     <xs:element name="node">         <xs:complextype>             <xs:sequence>                 <xs:element ref="node" />             </xs:sequence>         </xs:complextype>     </xs:element> </xs:schema> 

i totally mesmerized 0_0. how can achieve this?

if wish refer element, must declared top level. can have both root , node referring same element using:

<xs:element ref="node" /> 

that's why second example works. can use schema:

<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified">      <xs:element name="node">         <xs:complextype>             <xs:sequence>                 <xs:element ref="node" />             </xs:sequence>         </xs:complextype>     </xs:element>      <xs:element name="root">        <xs:complextype>            <xs:sequence>                <xs:element ref="node" />            </xs:sequence>        </xs:complextype>    </xs:element> </xs:schema> 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -