On Thu, Dec 06, 2012 at 03:39:43PM +0100, Frank Gross wrote: > Hi, > > Sorry if I was not clear enough. I wanted to know if there is an > option to allow relative namespaces to be handled silently by > libxml2. For instance, if I apply following patch, it solves my > issue because then xmlTextReader doesn't return with an malformed > error due to the relative namespace URI. > > Index: xmlreader.c > =================================================================== > --- xmlreader.c (revision 122919) > +++ xmlreader.c (working copy) > @@ -855,7 +855,7 @@ > (const char *) &inbuf->content[reader->cur], > CHUNK_SIZE, 0); > reader->cur += CHUNK_SIZE; > - if (val != 0) > + if ( (val != 0) && (val != XML_WAR_NS_URI_RELATIVE) ) > reader->ctxt->wellFormed = 0; > if (reader->ctxt->wellFormed == 0) > break; >
What you really want is the reader to not break on namespace errors or warning, only if a well-formedness error was found, which was fixed in the last chunk of that patch: http://git.gnome.org/browse/libxml2/commit/?id=6c91aa384f48ff6d406553a6dd47fd556c1ef2e6 diff --git a/parser.c b/parser.c index 28b0d80..19f1217 100644 --- a/parser.c +++ b/parser.c @@ -12219,7 +12219,10 @@ xmldecl_done: } ctxt->instate = XML_PARSER_EOF; } - return((xmlParserErrors) ctxt->errNo); + if (ctxt->wellFormed == 0) + return((xmlParserErrors) ctxt->errNo); + else + return(0); } /************************************************************************ Unfortunately I don't see any workaround beside applying that patch :-\ Daniel -- Daniel Veillard | Open Source and Standards, Red Hat [email protected] | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] https://mail.gnome.org/mailman/listinfo/xml
