At least one child

P

pawel.pabich

Hajo,

Example of XML:
<root>
<a/>
<b/>
<c/>
</root>

I need to ensure that one of a/b/c tags is present
and every of them can appear only once and they can
appear in any order.

any idea?

thanks in advance for info

Pawel
 
H

Harrie

(e-mail address removed) said the following on 2005-10-04 12:56 +0200:
I need to ensure that one of a/b/c tags is present

Are you talking about a Schema (DTD, XSD) or something else?
and every of them can appear only once and they can
appear in any order.

If they may only apear once, how can they appear in any order?
 
P

pawel.pabich

Hajo,

Soory, I am talking about schema.

Every tag can appear once, it means that following are valid:

<root>
<a/>
<b/>
</root>

<root>
<c/>
<b/>
</root>

but at least one of them has to be present.


Pawel
 
H

Henry S. Thompson

<xs:all>
<xs:element name="a" minOccurs="0"/>
<xs:element name="b" minOccurs="0"/>
<xs:element name="c" minOccurs="0"/>
</xs:all>

will get you most, but not all, of what you want -- W3C XML Schema has
no way to express the "at least one of them must be present"
constraint.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top