Re: [xml] DAV: namespace and xmlReader

You can overwrite error handler and reset the error manualy
(yes, I know this is ugly :( ):

static void
XmlStructuredErrorHandlerNoWarning (void * userData, xmlErrorPtr err)
    // WebDAV uses "bad" URIs for namespaces. We need to ignore
    // this error
    if(err && err->code == XML_WAR_NS_URI &&
       err->level == XML_ERR_WARNING) {
        if((err->domain == XML_FROM_PARSER) ||
           (err->domain == XML_FROM_HTML) ||
           (err->domain == XML_FROM_DTD) ||
           (err->domain == XML_FROM_NAMESPACE) ||
           (err->domain == XML_FROM_IO) ||
           (err->domain == XML_FROM_VALID)) {
           xmlParserCtxtPtr ctxt =
           if(ctxt) {
               ctxt->errNo = XML_ERR_OK;

    if (! err ||
          err->code == XML_ERR_OK ||
          err->level == XML_ERR_WARNING)

    XmlStructuredErrorHandler (userData, err);


Daniel Veillard wrote:
On Fri, Jan 21, 2005 at 09:58:19AM +0100, Minor Gordon wrote:


I am trying to parse WebDAV messages like the person below, and running into the same problem. The xmlReader in the latest version of libxml2 (.17) will not parse this -- it gives warning 99 (invalid namespace DAV:), and won't return the propfind element with xmlTextReaderConstLocalName. I've tried xmlSetPedanticParserDefault(0) and xmlResetLastError() to get around the warning, to no avail.

libxml2 .10 doesn't trip on this, so we've reverted for now. I would like to stay current with libxml2 fixes, though.

Is there any way to get around this?

  Reproduced the problem, I fixed it in CVS, it's the same problem as

I don't see an easy way to work around it right now except to find a way to
reset ctxt->errNo . But the fix is in CVS, and should be available quickly
in the cvs snapshot on


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