Re: XSD validation, ambiguous root XML instance element

On Sat, Oct 31, 2020 at 11:19 PM C. M. Sperberg-McQueen <
cmsmcq@blackmesatech.com> wrote:

The assertions contained in your xs:root element — they are to be applied
> on the validation root of any schema validity assessment?  Or on the root
> node of the document?


[mukul] The assertion that I specified within xs:root element, need to be
applied on the top most element of an XML instance document.

Do you really want to say, as part of the schema, that no user is ever
allowed to want to validate a single ‘q’ element in a document?

[mukul] Yes, that's what I meant.
For the example I posted earlier within this mail trail, I think what I
wanted, can also be achieved by setting up an XML processing pipeline
composing of : a thin XML SAX processing prohibiting certain XML root
elements, and then followed by XSD validation. Only when both of these
pipeline steps succeed, the complete XML processing would be considered as
a success.

I think a case can be made that it would be more convenient for the common
case, if the spec did allow a schema to say something about the documents
the schema is intended for, when a schema is intended to apply to whole
documents.  But unless things are very carefully defined, any such
provisions are likely to get in the way of users using a schema to validate
portions of XML documents, and they will certainly complicate the rules for
things like include, import, redefine, and override.

[mukul] I agree.



-- 
Regards,
Mukul Gandhi

Received on Sunday, 1 November 2020 05:16:55 UTC