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

The Archive Base Latest Questions

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

I’m trying to produce a pretty simple XML schema for an XML similar to

  • 0

I’m trying to produce a pretty simple XML schema for an XML similar to the following:

<messages>   <item>     <important_tag></important_tag>   </item>   <item>     <important_tag></important_tag>     <tag2></tag2>   </item>   <item>     <tag2></tag2>     <tag3></tag3>   </item> </messages> 

The idea is that <important_tag> will have a specific definition AND it may or may not appear under <item>. It may also appear more than once. Additionally, there may be other tags before or after <important_tag> that I can not name in advance.

I would like to give a specific definition for <important_tag>. For example, define attributes that it must contain. What I mean is that if important_tag is present it must conform to my definition. Any other tag doesn’t have to conform to any definition.

I tried using the following scheme:

<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>   <xs:element name='messages'>     <xs:complexType>       <xs:sequence>         <xs:element ref='item' maxOccurs='unbounded'/>       </xs:sequence>     </xs:complexType>   </xs:element>   <xs:element name='item'>     <xs:complexType>       <xs:sequence>         <xs:element ref='important_tag' minOccurs='0'/>         <xs:any minOccurs='0'/>       </xs:sequence>     </xs:complexType>   </xs:element>   <xs:element name='important_tag'>     <xs:complexType>       <xs:simpleContent>         ... specific definitions for important_tag ...       </xs:simpleContent>     </xs:complexType>   </xs:element> </xs:schema> 

This results in an error saying that the schema is ambiguous.

The exact error message is:

cos-nonambig: '<xs:element ref='important_tag'>' makes the content model non-deterministic against '<xs:any>'. Possible causes: name equality, overlapping occurrence or substitution groups. 

I’m using Altova’s XML Spy.

How do I solve this?

Thanks, Dana

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

    Regarding the error: that error message mentions a line that’s not in the xsd you included, but these two lines in it are ambiguous:

    <xs:element ref='important_tag' minOccurs='0'/> <xs:any minOccurs='0'/> 

    The simplest example to show the ambiguity is if there was just one <important_tag>:

      <important_tag></important_tag> 

    The problem is that it could be interpreted as one ‘important_tag’ and zero ‘any’ tags (which is what you wanted), but it can also be interpreted as zero ‘important_tag’ and one ‘any’ tags. This is because the ‘any’ tag can match any tag, including ‘important_tag’.

    I’ve read that the next version of XML Schema enables you to say what you meant: any tag except important_tag.

    Matching the XML in two different ways is similar to the regular expression ‘a*a*’ matching ‘a’ in two different ways (one first ‘a’; or one second ‘a’). This ambiguity used to be called ‘non-deterministic’ in the XML spec for DTDs, but the XML Schema spec calls it the Unique Particle Attribution rule (UPA), meaning that you should be able to tell which part of the schema gets each part of the XML document.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I am doing a simple coin flipping experiment for class that involves flipping a
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters

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.