Re: [xml] XML Schema Validation



On Thu, Jan 06, 2005 at 11:18:25AM -0500, Kent Wilson wrote:
Hello,

I have a question regarding the validation of XML schemas using libxml2. 
It is my understanding (In looking at the mail archive and the available doc-
umentation) that:

1.  libxml2 provides no support for at all for validation (DTD or Relax-NG) 
     of XML schemas if you are using the SAX model and APIs.

2. libxml2 provides support for validation of DTDs if you are using a DOM
    model and APIs.

3. libxml2 provides an "new" XmlTextReader interface which offers an altern-
    ative to SAX for "stream" processing of XML and also provides full DTD
    validation and partial or limited Relax-NG validation of the XML schema.

Is my understanding correct? 

  basically yes,

Concerning the XmlTextReader interface and validation:

1. What are the limitations or restrictions on performing Relax-NG validation.
     I  don't understand what the "...only subsets which cannot be..." comment
     means (see http://xmlsoft.org/xmlreader.html#Validating).

  You can build Relax-NG schemas for which I would need the full tree in
memory to assert the validation. But it's unlikely such a schemas be
designed for the class of document used in streaming.

2. If using the XmlTextReader interface for validation how much of the
    XML schema has to be kept in memory to perform the validation? My
    only concerng is that I don't defeat my original motiviation for using
    a "streaming" approach (i.e. a XmlTextReader (SAX-like)) to begin with.

  XmlTextReader supports Relax-NG validation, but not Schemas validation.
The answer depends on the Relax-NG used, basically as soon as a node content
model can be reduced to an deterministic automata, then its validation will
be streamed, so the granularity is the outmost element in the hierarchy
whose RNG content model cannot be mapped on a deterministic automata.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]