summaryrefslogtreecommitdiff
path: root/python/libxml.py
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2013-02-20 18:28:25 -0800
committerDaniel Veillard <veillard@redhat.com>2013-02-21 16:00:03 +0800
commite32ceb93f425ee852021ccda157fca923a1046b0 (patch)
tree273d6540ccce5201060742c7e5664540373068a3 /python/libxml.py
parent23f05e0c33987d6605387b300c4be5da2120a7ab (diff)
downloadlibxml2-e32ceb93f425ee852021ccda157fca923a1046b0.tar.gz
Python bindings: DOM casts everything to xmlNode
I noticed another issue with Python bindings of libxml: the access methods do not cast the pointers to specific classes such as xmlDtd, xmlEntityDecl, etc. For example, with the following document: <?xml version="1.0"?> <!DOCTYPE root [<!ELEMENT root EMPTY>]> <root/> the following script: import libxml2 doc = libxml2.readFile("c.xml", None, libxml2.XML_PARSE_DTDLOAD) print repr(doc.children) prints: <xmlNode (root) object at 0xb74963ec> With properly cast nodes, it outputs the following: <xmlDtd (root) object at 0xb746352c> The latter object (xmlDtd) enables one to use DTD-specific methods such as debugDumpDTD(), copyDTD(), and so on.
Diffstat (limited to 'python/libxml.py')
-rw-r--r--python/libxml.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/python/libxml.py b/python/libxml.py
index c861a70c..013d65c8 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -265,22 +265,22 @@ class xmlCore:
ret = libxml2mod.parent(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_children(self):
ret = libxml2mod.children(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_last(self):
ret = libxml2mod.last(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_next(self):
ret = libxml2mod.next(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_properties(self):
ret = libxml2mod.properties(self._o)
if ret == None:
@@ -290,7 +290,7 @@ class xmlCore:
ret = libxml2mod.prev(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_content(self):
return libxml2mod.xmlNodeGetContent(self._o)
getContent = get_content # why is this duplicate naming needed ?
@@ -317,7 +317,7 @@ class xmlCore:
ret = libxml2mod.parent(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "properties":
ret = libxml2mod.properties(self._o)
if ret == None:
@@ -327,22 +327,22 @@ class xmlCore:
ret = libxml2mod.children(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "last":
ret = libxml2mod.last(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "next":
ret = libxml2mod.next(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "prev":
ret = libxml2mod.prev(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "content":
return libxml2mod.xmlNodeGetContent(self._o)
elif attr == "name":