W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2020

Re: XSD validation, ambiguous root XML instance element

From: Mukul Gandhi <gandhi.mukul@gmail.com>
Date: Thu, 5 Nov 2020 11:23:57 +0530
Message-ID: <CABuuzNMpbuixdWXBv+CVVCGP7hcd6X8K8BnW0_tXi4m3NRJBHg@mail.gmail.com>
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
> 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

This archive was generated by hypermail 2.4.0 : Thursday, 5 November 2020 05:54:27 UTC