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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:54:32+00:00 2026-05-11T01:54:32+00:00

I have to make a schema for an XML format that’s already being used.

  • 0

I have to make a schema for an XML format that’s already being used. The existing XML is being generated already by a different program, and it sounds like it would be difficult to track down all the places that would need to be changed in order to use a more regular XML format.

Here’s an example similar to our XML structure:

<data>     <summary>some info</summary>     <error>error message (only if there was an error)</error>     <details>more info         <x>more</x>         <y>even more</y>     </details>     <error>another error message</error>     <z>some extra info</z> </data> 

Note that the error tag is reused at the same level and comes after certain items but not others, so I can’t just set maxOccurs=’unbounded’. I’ve tried wrapping the associated pairs of error/other tags in an xsd:sequence, but that doesn’t do the trick because I’m still effectively breaking the Unique Particle Attribution rule.

Can this even be done, or do I need to let the other developers know this schema isn’t going to validate?

  • 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-11T01:54:32+00:00Added an answer on May 11, 2026 at 1:54 am

    My reading of the XML schema standard says that you are probably safe. You just define non-consecutive elements with the same name in your schema, to reflect the XML as it will (or can be) generated. As long as all ‘error’ instances are always separated by other elements and not consecutive, this shouldn’t be a problem. For example, something like:

       <xs:element name='data'>     <xs:complexType>       <xs:sequence>         <xs:element name='summary' minOccurs='1' maxOccurs='1' type='xs:string' />         <xs:element ref='error' minOccurs='1' maxOccurs='1' />         <xs:element name='details' minOccurs='1' maxOccurs='1' type='detailsType' />         <xs:element ref='error' minOccurs='1' maxOccurs='1' />         <xs:element name='z' minOccurs='0' maxOccurs='1' type='xs:string' />       </xs:sequence>     </xs:complexType>   </xs:element>    <xs:element name='error' type='xs:string'/>    <xs:complexType name='detailsType'>     ....   </xs:complexType>  

    If details has minOccurs=’0′ and the first ‘error’ above has a maxOccurs > 1, then you fail the Unique Particle Attribution rule, because validation cannot verify, if you have two error elements in a row, which instance of ‘error’ in the schema they belong to. However, as long as each instance of ‘error’ can be uniquely identified in the schema, due to good use of ‘minOccurs’ and ‘maxOccurs’ for the error elements and for intervening elements, then you are good.

    You can even have consecutive instances of ‘error’ as long as the schema validator can always unambiguously figure out which instance is being referred to by using minOccurs and maxOccurs (for example).

    Think about xhtml, in which the elements may occur in any order, with arbitrary repetition.

    EDIT: Updated to reflect edits in original question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an existing XML schema that can be used to describe a generic
I have an XML Schema that looks like this: <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element name=root> <xs:complexType>
I have a custom XML schema defined for page display that puts elements on
Using this sample : I have make my own Fragment that holds tabhost and
I have to make apps for that work on both iOS 4 and iOS
I have to make an SQL command that look for a String in the
I am trying to create a Xml schema for a xml file that looks
I have an ASP.Net MVC site that generates a Microsoft Excel 2003 XML formatted
I have a Custom List Definition (schema.xml) i have set up Site Columns (through
I'm trying to make up an xml schema for the following: <tagSet> <Structure> <tag>

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.