On Fri, Feb 09, 2007 at 10:29:39AM -0600, David D. Hagood wrote:
> I'd like to check my understanding:
> 
> According to the documentation, if you want to have an xmlTextReader do 
> schema validation, you have to set the schema before the first read call 
> on the text reader.

  right

> HOWEVER, if you are trying to make a reader routine which can handle 
> multiple document types, you don't know the doc type until you've read 
> the DOCTYPE element, which you don't know until you've done a Read on 
> the Reader - which makes it too late to activate a schema.
> 
> So as I read it, there is no way to read the first 2 lines of a stream 
> (which may not be seekable), deduce the schema needed from the DOCTYPE 
> record, then activate the appropriate schema.
> 
> Is this a correct assessment?

  I think yes. Maybe xmlTextReaderSetSchema could be tweaked to allow
setting it as long as the start tag of the root element has not been
processed, code wise the change might be simple but it would require 
additional testing. Basically it would require replacing:
      if (reader->mode != XML_TEXTREADER_MODE_INITIAL)
              return(-1);
in xmlTextReaderSetSchema() by a more lax definition checking where we are
in the reader process within the document.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to