Re: [xml-bindings]CDATA nodes have no name?
- From: Daniel Veillard <veillard redhat com>
- To: Marc-Antoine Parent <maparent acm org>
- Cc: xml-bindings gnome org
- Subject: Re: [xml-bindings]CDATA nodes have no name?
- Date: Sat, 6 Dec 2003 20:31:34 -0500
On Sat, Dec 06, 2003 at 03:56:14PM -0500, Marc-Antoine Parent wrote:
> But I am interested in another issue, now:
> In libxml.py:
> def nodeWrap(o):
> # TODO try to cast to the most appropriate node class
> name = libxml2mod.name(o)
> if name == "element" or name == "text":
> ....
>
> This crashes on CDATA nodes as they have a name of None. (Or NULL from
> a C standpoint.) I notice that the python code did not change in 2.6.1.
> Do CDATA nodes still return a vacuous name?
Hum, the data type should be checked first,
> I find I am a bit confused between libxml_name and libxml_type in
> libxml.c, as nodeWrap seems to use the former, but take results that
> look as if they came from the latter.
>
> My solution was to correct
> if name == "element" or name == "text":
>
> but my CDATA object prints out as <xmlNode (None) object at 0x1061030>
> and not <xmlNode (cdata) object at 0x1061030> as I would like... Though
> getting at its type or calling getContent() gives me a correct answer!
The type should really be used to make the differentiation, not
the returned name. For example it's perfectly legal to name element nodes
"text" like in <text/> ...
> Anyway, could someone tells me if this has been fixed in latter
> releases, and what behaviour I should expect from them?
The fix should be to do the test in a different way.
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]