Groups | Blog | Home
all groups > dotnet xml > july 2007 >

dotnet xml : Child elements cant have the name



Leeor Chernov
7/18/2007 12:00:00 AM
Hi ,
I need an article(Page URL) that shows
that child elements on the same level cant have the same name(Validation is
illegal...)....
for example :
<Parent>
<item/>
<item/>
<item/>
</Parent>


Thanks....

Martin Honnen
7/18/2007 12:00:00 AM
[quoted text, click to view]

If you want to write a schema only allowing a single item child then use
e.g.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xs:element name="Parent">
<xs:complexType>
<xs:sequence>
<xs:element name="item"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
With that schema exactly one item element is both allowed and necessary.
No item element or several item elements are invalid.


--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button