def __getattr__(self, attr): if attr == "parent": ret = libxml2mod.parent(self._o) if ret == None: return None return nodeWrap(ret) elif attr == "properties": ret = libxml2mod.properties(self._o) if ret == None: return None return xmlAttr(_obj=ret) elif attr == "children": ret = libxml2mod.children(self._o) if ret == None: return None return nodeWrap(ret) elif attr == "last": ret = libxml2mod.last(self._o) if ret == None: return None return nodeWrap(ret) elif attr == "next": ret = libxml2mod.next(self._o) if ret == None: return None return nodeWrap(ret) elif attr == "prev": ret = libxml2mod.prev(self._o) if ret == None: return None return nodeWrap(ret) elif attr == "content": return libxml2mod.xmlNodeGetContent(self._o) elif attr == "name": return libxml2mod.name(self._o) elif attr == "type": return libxml2mod.type(self._o) elif attr == "doc": ret = libxml2mod.doc(self._o) if ret == None: if self.type == "document_xml" or self.type == "document_html": return xmlDoc(_obj=self._o) else: return None return xmlDoc(_obj=ret) raise AttributeError(attr)
def __getattr__(self, attr): if attr == "parent": ret = libxml2mod.parent(self._o) if ret == None: return None return xmlNode(_obj=ret) elif attr == "properties": ret = libxml2mod.properties(self._o) if ret == None: return None return xmlAttr(_obj=ret) elif attr == "children": ret = libxml2mod.children(self._o) if ret == None: return None return xmlNode(_obj=ret) elif attr == "last": ret = libxml2mod.last(self._o) if ret == None: return None return xmlNode(_obj=ret) elif attr == "next": ret = libxml2mod.next(self._o) if ret == None: return None return xmlNode(_obj=ret) elif attr == "prev": ret = libxml2mod.prev(self._o) if ret == None: return None return xmlNode(_obj=ret) elif attr == "content": return libxml2mod.xmlNodeGetContent(self._o) elif attr == "name": return libxml2mod.name(self._o) elif attr == "type": return libxml2mod.type(self._o) elif attr == "doc": ret = libxml2mod.doc(self._o) if ret == None: if self.type == "document_xml" or self.type == "document_html": return xmlDoc(_obj=self._o) else: return None return xmlDoc(_obj=ret) raise AttributeError,attr
def Node_attributes(node): attributes = {} # Include normal attributes. current = libxml2mod.properties(node) while current is not None: ns = libxml2mod.xmlNodeGetNs(current) if ns is not None: attributes[(get_ns(ns), libxml2mod.name(current))] = current else: attributes[(None, libxml2mod.name(current))] = current current = libxml2mod.next(current) # Include xmlns attributes. #current = libxml2mod.xmlNodeGetNsDefs(node) #while current is not None: # ns = get_ns(current) # prefix = libxml2mod.name(current) # attributes[(xml.dom.XMLNS_NAMESPACE, "xmlns:" + prefix)] = ns # NOTE: Need a real node here. # current = libxml2mod.next(current) return attributes
def get_properties(self): ret = libxml2mod.properties(self._o) if ret == None: return None return xmlAttr(_obj=ret)