Re: [xml] Ability to plug in schema validation on top libxml2 SAX parser



On Fri, Mar 04, 2011 at 11:31:29AM -0800, Sarmishtha Bhattacharya wrote:
Hi,

Thanks for you reply, but i have passed the xml and schema properly and
am able to get the validation and parsing done separately, only when i
attempt
to use the xmlSchemaValidateStream() with the saxHandler it gives me this
error.
After investigating i saw that if i comment

saxHandler->startElement = &ParseData::start_parse;
saxHandler->endElement = &ParseData::end_parse;

the very same piece of code validates and parses properly.

  okay, but that piece of code is not what you sent, at best you sent
a minimal extract without the part initilizing the schemas.
  W.r.t. the "problem" that's normal the SAX schemas validation need to
see those events to be able to validate, a posteriori that sounds clear.
 See xmlSchemaSAXPlug() in xmlschemas.h

/**
 * xmlSchemaSAXPlug:
 * @ctxt:  a schema validation context
 * @sax:  a pointer to the original xmlSAXHandlerPtr
 * @user_data:  a pointer to the original SAX user data pointer
 *
 * Plug a SAX based validation layer in a SAX parsing event flow.
 * The original @saxptr and @dataptr data are replaced by new pointers
 * but the calls to the original will be maintained.
 *
 * Returns a pointer to a data structure needed to unplug the validation
 * layer
 *         or NULL in case of errors.
 */

Please do not think i haven't gone through your working code.
It has helped me a lot, but there these 2 callbacks have not be set there.

  The fundamental problem is to send a message along the line
"I have a problem" where I can'y make any analysis without tons of
guessing, and hence very likely to just waste time.

Someone blogged recently on a humourous mode about this:
  http://who-t.blogspot.com/2011/03/how-to-dos-developer.html

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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