[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] Ability to make parser ignore the XML_NS_ERR_UNDEFINED_NAMESPACE error
- From: Daniel Veillard <veillard redhat com>
- To: Greg Shtilman <gmatroskin yahoo com>
- Cc: xml gnome org
- Subject: Re: [xml] Ability to make parser ignore the XML_NS_ERR_UNDEFINED_NAMESPACE error
- Date: Wed, 10 Mar 2004 04:30:54 -0500
On Tue, Mar 09, 2004 at 04:43:20PM -0800, Greg Shtilman wrote:
> Hi,
>
> I am trying to find out why a missing namespace
> declaration was made a FATAL error in 2.6.x? We use
> libxml to parse 'snippets' of XML that are missing the
> namespace declarations by design. We used to set the
> ignore warnings flag in the older libxml, but are
> considering an upgrade to 2.6.6 now, and discovering
> that the only way to make libxml 'happy' is to
> surround the document with a dummy root node that has
> the namespace declarations prior to parsing, and
> removing them when dumping. Would it be possible to
> provide a flag, or some other means (such as the
> ability to predefine the namespaces) to make these
> warnings ignorable in such a case?
paphio:~/XML -> cat tst2.xml
<doc s:b="foo"/>
paphio:~/XML -> xmllint tst2.xml
tst2.xml:1: namespace error : Namespace prefix s for b on doc is not defined
<doc s:b="foo"/>
^
<?xml version="1.0"?>
<doc b="foo"/>
paphio:~/XML ->
it is a namespace error, not a well-formedness error. libxml2
still continues to parse the document and produce a tree in that case.
You can filter errors by domain and catch namespace errors. See
<libxml/xmlerror.h> for a the associated APIs and definitions.
It's the first time someone complains about the new parser behaviour,
in itself it's an interesting point.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]