class XmlNode:
def __init__(self, node, namespaces):
self.node = node
+ self.text = node.text
self.namespaces = namespaces
self.attrib = node.attrib
+
def xpath(self, xpath, namespaces=None):
if not namespaces:
parent = element.getparent()
parent.remove(element)
+ def remove(element):
+ self.node.remove(element)
+
def set(self, key, value):
self.node.set(key, value)
self.parse_xml(xml)
if isinstance(xml, XmlNode):
self.root = xml
- self.namespces = xml.namespaces
+ self.namespaces = xml.namespaces
elif isinstance(xml, etree._ElementTree) or isinstance(xml, etree._Element):
self.parse_xml(etree.tostring(xml))