On Wed, Jun 27, 2007 at 08:28:19PM +0800, Harbhanu wrote:
> Hi,
> 
> I wanted to know the best way to do Schema validation incase I want to use
> SAX parsing.
> 
/**
 * xmlSchemaValidateStream:
 * @ctxt:  a schema validation context
 * @input:  the input to use for reading the data
 * @enc:  an optional encoding information
 * @sax:  a SAX handler for the resulting events
 * @user_data:  the context to provide to the SAX handler.
 *
 * Validate an input based on a flow of SAX event from the parser
 * and forward the events to the @sax handler with the provided @user_data
 * the user provided @sax handler must be a SAX2 one.
 *   
 * Returns 0 if the document is schemas valid, a positive error code
 *     number otherwise and -1 in case of internal or API error.
 */


SAX is a bad API I discourage its use 

> Is the only way out is to do it as a separate step?? Then effectively we
> will be doing parsing of the same document twice.

  definitely not there are code in xmllint doing this.

> 
> Also, theoretically can schema validation be performed on a partially read
> XML document??

theorically maybe and practically no, it's defined on full documents as far
as I understand, though there is a notion of partial validation but way beyond
my understanding of the spec, and I don't think it's possible in libxml2.

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