OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Duplicate element decl in the same scope

[ Lists Home | Date Index | Thread Index ]
  • To: "Bryan Rasmussen" <bry@itnisk.com>,<xml-dev@lists.xml.org>
  • Subject: RE: [xml-dev] Duplicate element decl in the same scope
  • From: "Robert Soesemann" <rsoesemann@sapient.com>
  • Date: Tue, 11 Jan 2005 15:08:49 +0100
  • Thread-index: AcT35kBz68JUVU+lStWCSnF7u4JYsgAAGpWA
  • Thread-topic: [xml-dev] Duplicate element decl in the same scope

Thanks a lot for this example. But it won't work as I need to put
additional constraints on the XSD. There might be <element type="foo">
that must appear inside the XML and <element type="bar"> that is
optional. 
I guess there is no way to express that with your solution.

Robert

-----Original Message-----
From: Bryan Rasmussen [mailto:bry@itnisk.com] 
Sent: Dienstag, 11. Januar 2005 15:00
To: xml-dev@lists.xml.org
Subject: RE: [xml-dev] Duplicate element decl in the same scope


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>
> > 
> > 
> 
> 
> 



-----------------------------------------------------------------
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>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS