← Prev in month ← Prev in thread

Duplicate element decl in the same scope

From
Robert Soesemann <>
To
Date
2005-01-11T13:01:18Z
ID
<>
Thread
Duplicate element decl in the same scope
Hello,

For the XML format of my application I need to store semantics inside
attribute value:

So instead of (A) I need (B):
(A)
<root>
	<ELEM1/>
	<ELEM2/>
</root>
(B)
<root>
	<top name="ELEM1"/>
	<top name="ELEM2"/>
</root>

The problem I face is how to validate this with XMLSchema as e.g. two
<top> elements are different only regarding an attribute value. You find
a simple example of an XSD snippet where I test the above XML with
xs:all.

<xs:element name="root">
  <xs:complexType>
   <xs:all>
    <xs:element name="element">
     <xs:complexType>
      <xs:attribute name="name" type="xs:string" fixed="ELEM1"/>
     </xs:complexType>
    </xs:element>
    <xs:element name="element">
     <xs:complexType>
      <xs:attribute name="name" type="xs:string" fixed="ELEM2"/>
     </xs:complexType>
    </xs:element>
   </xs:all>
  </xs:complexType>
 </xs:element>

When I validate this XSD *itself* I get the following error inside my
XML Suite: 
"Duplicate element decl in the same scope: element
'element' and 'element' violate the Unique Particle Attribution rule"

Any solutions. Is this not solveable in XSD?

Robert
← Prev in month ← Prev in thread