Re: [xml] xmlTextReader and parsing namespace with relative URI


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)


Le 03/12/2012 16:49, Frank Gross a écrit :

In version 2.7.1, when I use xmlNewTextReader and read an XML document with relative namespaces from the network, after a call to xmlTestReaderRead(), I get an error because document is malformed. Actually, I noticed that in xmlTextReaderPushData() a call to xmlParseChunk() sets the reader to not wellFormed because the XML_WAR_NS_URI_RELATIVE error is returned. Is there a way to get rid of this error ? I tried with XML_PARSE_NOWARNING option, but without success.


Software Engineer - Web Services
Four J's Development Tools -

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