Re: [xml] Question regarding Xpath and streaming
- From: Daniel Veillard <veillard redhat com>
- To: "Yong Chen (yongche)" <chen cisco com>
- Cc: xml gnome org
- Subject: Re: [xml] Question regarding Xpath and streaming
- Date: Thu, 28 Jun 2007 06:48:00 -0400
On Wed, Jun 27, 2007 at 04:37:06PM -0700, Yong Chen (yongche) wrote:
On the same note, is there any way to validate a document (against a
schema) which is being streamed out using xmlWriter?
"xmlSchemaValidateDoc(validCtxtPtr, doc)" needs a "doc", but when doing
streaming, I don't have the full doc available.
Validation is usually done at parsing time. Schemas validation can
be streamed on top of the reader or SAX. There is nothing available
for the writer. For SAX see
/**
* 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.
*/
there is an example of use in xmllint.c
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
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]