Re: [xml] question about how to set namespace in libxml



Daniel Veillard schrieb am 06.03.2011 um 22:18 (+0800):
On Sun, Mar 06, 2011 at 12:43:23PM +0100, Michael Ludwig wrote:
But what about the question I raised? Is it possible to turn off
namespace awareness with libxml2 using any of the other parsers?

* using the DOM parser?
* using the SAX parser?
* using the pull parser (XML reader)?

  Well actually I consider this a bug, the fact that the XML is not
namespace compliant should not make the ns: prefixes disapear. It used
to be true and it broke at some point. IMHO there should be no flag
to pass it's just a bug. I should probably investigate.

Merci! What I wanted to know is if there is an option to just turn off
namespaces, so a document such as the one the OP posted is well-formed
(which it is), just not namespace-well-formed. Users might then choose
whether they want the parser to do namespaces or not.

Ah, I think you're saying that namespace declarations (xmlns attributes)
will cause the parser to do namespaces while colonized names without
namespace declarations should still parse fine?

But wouldn't that raise problems when there are *some* namespace
declarations but also some colonized names which the doc does not
account for with namespace declarations? Would the document then fall
into a grey zone between namespace-well-formed and just well-formed?
And wouldn't it be clearer if users communicated their intentions by
passing a flag to turn namespaces off, or on?

-- 
Michael Ludwig



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