Re: [xml] Is ignoring namespace and DTDs an xmllint or libxml2 problem?



Michael Ludwig schrieb am 07.01.2012 um 18:54 (+0100):

You'd need a parser configuration that has namespaces switched off.
That should be available as "xmllint --sax1" (the old SAX 1 didn't
know about namespaces), but even then xmllint emits the warning and
drops the part before the colon, which I think is a bug.

This is the namespaced SAX 2:

void startElementNsSAX2Func (void * ctx, 
                 const xmlChar * localname, 
                 const xmlChar * prefix, 
                 const xmlChar * URI, 
                 int nb_namespaces, 
                 const xmlChar ** namespaces, 
                 int nb_attributes, 
                 int nb_defaulted, 
                 const xmlChar ** attributes)

And this is the old you could use to build your own parser without
namespace-awareness:

xmlSAXHandlerV1

void startElementSAXFunc (void * ctx, 
                 const xmlChar * name, 
                 const xmlChar ** atts)

See here: http://xmlsoft.org/html/libxml-parser.html

But I just realise you might not know how namespaces work â
You have to *fix* your doc to *declare* the namespace:

  <bla:a xmlns:bla="urn:bla-bla"/>

-- 
Michael Ludwig



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