Re: [xml] Preserving namespace prefix when doc does not contain proper NS declaration
- From: Daniel Veillard <veillard redhat com>
- To: Shane Adams <adamsch1 yahoo com>
- Cc: xml gnome org
- Subject: Re: [xml] Preserving namespace prefix when doc does not contain proper NS declaration
- Date: Wed, 20 Jul 2005 20:16:06 -0400
On Wed, Jul 20, 2005 at 05:05:37PM -0700, Shane Adams wrote:
Hi - I searched the archives and looked at the API,
hope I'm not missing something obvious. I'm parsing
RSS feeds, alot of feeds contain extensions. These
extra tags should be declared by a proper namespace
declaration, but in many cases they are not.
Is there a way to force libxml2 to parse the document,
Yes libxml2 will parse the cocument if it is well-formed for XML-1.0
you will get non-fatal namespace errors though.
and preserve the 'prefix' to a namespace that is not
defined?
I don't understand what it means. Libxml2 behaviour is the following:
laptop:~/XML -> cat tst.xml
<foo>
<present:bar xmlns:present="http://example.com"/>
<missing:bar/>
</foo>
laptop:~/XML -> xmllint --debug tst.xml
tst.xml:3: namespace error : Namespace prefix missing on bar is not defined
<missing:bar/>
^
DOCUMENT
version=1.0
URL=tst.xml
standalone=true
ELEMENT foo
TEXT
content=
ELEMENT present:bar
namespace present href=http://example.com
TEXT
content=
ELEMENT bar
TEXT
content=
seems the prefix part of the element name is missing, looks like a bug.
But libxml2 should not "invent" a namespace.
Daniel
--
Daniel Veillard | Red Hat Desktop team http://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]