Re: [xml] Why structured error callback registered on sax handler be called to raise schema validation error?



On Fri, Oct 24, 2008 at 01:18:28PM +0530, Rabi Narayan Sahoo wrote:
Hi

We use xmlSchemaValidateStream() function to validate an input based on a
flow of SAX event from the parser.

When some validation error occurs, to raise that error subsequently
__xmlRaiseError() is called by the libxml.

But for the schema validation error the structured error callback registered
on the sax handler

is not called because of the following piece of code in __xmlRaiseError ()
controlling the call

if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||

        (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||

       (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {

       ctxt = (xmlParserCtxtPtr) ctx;

       if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&

           (ctxt->sax->initialized == XML_SAX2_MAGIC))

           schannel = ctxt->sax->serror;

    }

    

For a schema validation error this domain is XML_FROM_SCHEMASV. 

My question is why for the schema validation errors we can't call the
structured error callback registered on the SAX Handler?

  That looks like an oversight. What happens if you patch that code to
allow that domain ? if that works send a patch,

  thanks,

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]