[Home] [By Thread] [By Date] [Recent Entries]
I forgot to cc xml-dev, to make sure it gets to you (since I've been having some problems with my web-based mail i will send this there now) the following fragment <xs:element name="root" type="one:blah"> <xs:unique name="element1"> <xs:selector xpath="one:element"></xs:selector> <xs:field xpath="@name"></xs:field> </xs:unique> </xs:element> <xs:complexType name="blah"> <xs:sequence> <xs:element name="element" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="name" type="xs:string"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> without a specific type for the name attribute does the uniqueness constraint. -- Bryan Rasmussen Citat Robert Soesemann <rsoesemann@s...>: > Could you please give a short example. I don't understand exactely how > this could solve my problem. > > -----Original Message----- > From: Bryan Rasmussen [mailto:bry@i...] > Sent: Dienstag, 11. Januar 2005 14:13 > To: Robert Soesemann > Cc: xml-dev@l... > Subject: Re: Duplicate element decl in the same scope > > > How about the following hack, you specify a pattern for what the > attributes have to have as a possible value, then you use xsd:unique to > make sure that an attribute value does not repeat. > -- > Bryan Rasmussen > > > Citat Robert Soesemann <rsoesemann@s...>: > > > 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 > > > > ----------------------------------------------------------------- > > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > > initiative of OASIS <http://www.oasis-open.org> > > > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > > > To subscribe or unsubscribe from this list use the subscription > > manager: <http://www.oasis-open.org/mlmanage/index.php> > > > > > > >
|

Cart



