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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Just use: ObservableCollection<Foo> x = new ObservableCollection<Foo>(enumerable); That will do… May 12, 2026 at 1:35 pm
  • Editorial Team
    Editorial Team added an answer Something like this, it will get you started (just a… May 12, 2026 at 1:35 pm
  • Editorial Team
    Editorial Team added an answer Implement IDataErrorInfo. Don't throw an exception, because even with HandleError… May 12, 2026 at 1:35 pm

Related Questions

I have to make a schema for an XML format that's already being used.
Problem Statement I'm writing a very basic WPF application to alter the contents of
With Excel 2003 and higher it is possible to use the SpreadsheetML format to
I need to build an XML document from a Java object hierarchy. Both the
When I first saw XML, I thought it was basically a representation of trees.

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.