Re: XSD validation, ambiguous root XML instance element

> Hi all,
    With respect to the discussion currently going on within this thread,
I'd like to share following thoughts about XSD (broken into 2 cases A & B),

(A)

Let's say that, following is a given XSD document (and this is the only XSD
document, that available for an XML document validation),

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

     <xs:element name="m"/>

     <xs:element name="n"/>
</xs:schema>

According to above mentioned XSD document, following two XML instance
documents would be valid,

1)
<m/>

2)
<n/>

(B)

And, if following is an XSD document (and this is the only XSD document,
that available for an XML document validation),

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

     <xs:element name="m"/>
</xs:schema>

following is the only XML instance document (its my personal choice, to
ignore XML child elements and attributes), that would be valid according to
above mentioned XSD document,

<m/>

The XSD case (B) above, effectively makes a constraint that, XML element
name "m" can be the only XML instance document root element name.

The XSD case (A) mentioned above, allows for both "m" and "n" to be
valid XML instance document root element names.

May be, further discussion on this topic, can assume facts that I've
mentioned in this mail.




-- 
Regards,
Mukul Gandhi

Received on Thursday, 5 November 2020 05:54:26 UTC