Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3804564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:32:18+00:00 2026-05-19T14:32:18+00:00

I am just learning XML/XSD and am struggling with the implementation of an XML-schema

  • 0

I am just learning XML/XSD and am struggling with the implementation of an XML-schema which models a folder structure.
What I had in mind was defining a complexType for the folder which can have additional folder instances that represent subfolders. Using the xsd schema validator here always returns that the schema is invalid.

I tried defining the complexType up front and then using the ref keyword for subfolders:

<xs:complexType name="tFolder">
 <xs:sequence>
  <xs:element name="Path" type="tFolderType" msdata:Ordinal="0" />                    
  <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" />
  <xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded">
    <xs:complexType>
      <xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0">
        <xs:extension base="xs:string">
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>                              
 </xs:sequence>
<xs:attribute name="Type" type="tFolderType" />

As for the element itself:

<xs:element name="Folder" type="tFolder" />

The error returned by the validator is:

“Cannot resolve the name ‘Folder’ to a(n) ‘element declaration’ component.”

and the error occurs at the line

<xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" />

Defining the complexType within the element itself yields the exact same error:

<xs:element name="Folder">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Path" type="tFolderType" msdata:Ordinal="0" />
      <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" />                          
      <xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0">
            <xs:extension base="xs:string">
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>                              
    </xs:sequence>
    <xs:attribute name="Type" type="tFolderType" />
  </xs:complexType>
</xs:element>

What I’ve read, this kind of recursion should work using ref.

Can anyone tell me what I’ve done wrong? Maybe the xsd validator is just faulty? If so, does anyone know a better alternative? I’ve tried using the one from w3.org as well, but it seems to be taken offline…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:32:19+00:00Added an answer on May 19, 2026 at 2:32 pm

    I think this is the way to do it (don’t use ref):

    <element name="test" type="tns:TestType"></element>
    
    <complexType name="TestType">
        <sequence>
            <element name="test" type="tns:TestType"></element>
        </sequence>
    </complexType>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just learning about LINQ to XML in all its glory and frailty,
I'm just learning LINQ and in particular LINQ to XML, and I've written up
I've just recently begun learning XML in the context of PHP and Javascript, and
I'm just learning scala and im trying to import an XML file to a
I have a simplistic app (just learning) that reads some XML data from a
Hi I have just started learning about xsd as I want to use it
I'm just learning and playing with the apple Seismic XML example http://developer.apple.com/library/ios/#samplecode/SeismicXML/Introduction/Intro.html I've got
I'm just learning PERL. I've read some docs on parsing XML and reused some
I am just learning to write XML and associated DTD's, and I'm wondering if
Just started learning NHiberate. It seems rather tedious to write proper hbm.xml config files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.