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 51309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:43:49+00:00 2026-05-10T16:43:49+00:00

I try to define a schema for XML documents I receive. The documents look

  • 0

I try to define a schema for XML documents I receive.

The documents look like:

<root>     <items>         <group name='G-1'>             <item name='I-1'/>             <item name='I-2'/>             <item name='I-3'/>             <item name='I-4'/>         </group>     </items>     <data>         <group name='G-1' place='here'>             <customer name='C-1'>                 <item name='I-1' count='3'/>                 <item name='I-2' count='4'/>             </customer>             <customer name='C-2'>                 <item name='I-3' count='7'/>             </customer>         </group>     </data> </root> 

I tried XmlSpy and xsd.exe from .NET 2.0. Both created schema definitions which allow below <group> any number of <item> and <customer> elements. But what I’m looking for should restrict <group> below <items> to <item> elements, and <group> below <data> to <customer> elements.

Is this something xml schema is not capable at all?

  • 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. 2026-05-10T16:43:49+00:00Added an answer on May 10, 2026 at 4:43 pm

    Yes, XSD can handle this. I generated this schema from Visual Studio 2008 (much faster than doing it by hand) and it will do what you’re looking for:

    <?xml version='1.0' encoding='utf-8'?> <xs:schema attributeFormDefault='unqualified' elementFormDefault='qualified' xmlns:xs='http://www.w3.org/2001/XMLSchema'>   <xs:element name='root'>     <xs:complexType>       <xs:sequence>         <xs:element name='items'>           <xs:complexType>             <xs:sequence>               <xs:element name='group'>                 <xs:complexType>                   <xs:sequence>                     <xs:element maxOccurs='unbounded' name='item'>                       <xs:complexType>                         <xs:attribute name='name' type='xs:string' use='required' />                       </xs:complexType>                     </xs:element>                   </xs:sequence>                   <xs:attribute name='name' type='xs:string' use='required' />                 </xs:complexType>               </xs:element>             </xs:sequence>           </xs:complexType>         </xs:element>         <xs:element name='data'>           <xs:complexType>             <xs:sequence>               <xs:element name='group'>                 <xs:complexType>                   <xs:sequence>                     <xs:element maxOccurs='unbounded' name='customer'>                       <xs:complexType>                         <xs:sequence>                           <xs:element maxOccurs='unbounded' name='item'>                             <xs:complexType>                               <xs:attribute name='name' type='xs:string' use='required' />                               <xs:attribute name='count' type='xs:unsignedByte' use='required' />                             </xs:complexType>                           </xs:element>                         </xs:sequence>                         <xs:attribute name='name' type='xs:string' use='optional' />                       </xs:complexType>                     </xs:element>                   </xs:sequence>                   <xs:attribute name='name' type='xs:string' use='required' />                   <xs:attribute name='place' type='xs:string' use='required' />                 </xs:complexType>               </xs:element>             </xs:sequence>           </xs:complexType>         </xs:element>       </xs:sequence>     </xs:complexType>   </xs:element> </xs:schema> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 88k
  • Answers 88k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is the shortest superstring problem: find the shortest string… May 11, 2026 at 5:43 pm
  • Editorial Team
    Editorial Team added an answer Rather than writing code to explicitly add things to the… May 11, 2026 at 5:43 pm
  • Editorial Team
    Editorial Team added an answer Basically you need a little linear geometry/algebra, and/or a package… May 11, 2026 at 5:43 pm

Related Questions

I have seen many references stating that TableAdapters are weak and silly, and that
I have a service contract that defines a method with a parameter of type
OK... I'm a VB.NET WinForms guy trying to understand WPF and all of its
I'm writing an application that on some stage performs low-level disk operations in Linux

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.