[
Lists Home |
Date Index |
Thread Index
]
- To: xml-dev@lists.xml.org
- Subject: RE: [xml-dev] Duplicate element decl in the same scope
- From: Bryan Rasmussen <bry@itnisk.com>
- Date: Tue, 11 Jan 2005 14:59:38 +0100
- In-reply-to: <D8592BFB6BB4CA43B70558B8ECB6C185697D8F@munsmsx01.sapient.com>
- References: <D8592BFB6BB4CA43B70558B8ECB6C185697D8F@munsmsx01.sapient.com>
- User-agent: Internet Messaging Program (IMP) 3.2.2
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@sapient.com>:
> 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@itnisk.com]
> Sent: Dienstag, 11. Januar 2005 14:13
> To: Robert Soesemann
> Cc: xml-dev@lists.xml.org
> Subject: Re: [xml-dev] 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@sapient.com>:
>
> > 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>
> >
> >
>
>
>
|