Re: comments and PIs in XML Schema

At 2009-04-25 08:10 +0530, Mukul Gandhi wrote:
>   I couldn't see provisions in the XML Schema languages (both 1.0 and
>1.1) to have XML "comments" and "processing instructions" as part of
>the validation requirements.
>
>Why are "comments" and PIs not considered XML Schema validation primitives?

I call these two constructs "XML annotations" though that is not an 
official term for them, only a convenient pigeon hole or label for them.

Schema languages constrain XML vocabularies and their 
content.  Comments and processing instructions are not part of an XML 
vocabulary, only elements and attributes and their content.

Annotations can be placed anywhere they are allowed in an XML 
document without violating the constraints on an XML vocabulary.

You won't see constraints on comments and PIs in DTD, W3C Schema, 
RELAX-NG or NVDL semantics.  I doubt any of the prototypical or 
bespoke XML vocabulary validation languages would constrain these 
either.  I suppose someone could dream up some validation semantics 
to constrain them, and implement them with something like 
Schematron.  But that would be more like a "document writing 
constraint" rather than an XML vocabulary constraint.

>Please pardon me, if I am missing something.

http://www.w3.org/TR/xml/#syntax
   - Text consists of intermingled character data and markup

http://www.w3.org/TR/xml/#sec-comments
   - They are not part of the document's character data; an XML
     processor MAY, but need not, make it possible for an application
     to retrieve the text of comments

http://www.w3.org/TR/xml/#sec-pi
   - PIs are not part of the document's character data, but MUST
     be passed through to the application.

I hope this helps.

. . . . . . . . . Ken

--
XQuery/XSLT/XSL-FO hands-on training - Los Angeles, USA 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Received on Saturday, 25 April 2009 05:05:41 UTC