I need to parse partial XML fragments (which are represented as std :: string), for example:
<FOO:node>val</FOO:node>
as xmlDocobjects in libxml2, and since these are fragments, I keep getting errors namespace error : Namespace prefix FOO on node is not definedthat spit out in STDERR.
What I'm looking for is a way to filter only these warnings from a namespace or parse an XML fragment directly into an object xmlNode.
I think some hacking with initGenericErrorDefaultFunc () may be for going the first way, but the documentation for libxml2 is absolutely terrible.
I would frankly prefer to go with the second approach, because this would not require hacking errors, and node would already know about the namespace, but I do not think that this is possible, because node must have root and XML fragments are not guaranteed to have only one root.
I just need some guidance here on how to get rid of the namespace error warning.
Many thanks.
source
share