1.1 --- a/__init__.py Mon Oct 06 21:59:05 2003 +0000
1.2 +++ b/__init__.py Mon Oct 06 22:11:00 2003 +0000
1.3 @@ -77,12 +77,6 @@
1.4 self.nodeType = nodeType
1.5 self.prefix, self.localName = _get_prefix_and_localName(self.name)
1.6
1.7 -class TemporaryText(object):
1.8 - def __init__(self, _text):
1.9 - self.ns = self.name = self.prefix = self.localName = None
1.10 - self.nodeType = xml.dom.Node.TEXT_NODE
1.11 - self._text = _text
1.12 -
1.13 class Node(object):
1.14
1.15 _nodeTypes = {
1.16 @@ -237,7 +231,7 @@
1.17 return TemporaryNode(ns, name, xml.dom.Node.ATTRIBUTE_NODE)
1.18
1.19 def createTextNode(self, value):
1.20 - return TemporaryText(self._node.doc.newDocText(value))
1.21 + return Node(libxml2.newText(value))
1.22
1.23 def _add_node(self, tmp):
1.24 if tmp.nodeType == xml.dom.Node.ATTRIBUTE_NODE:
1.25 @@ -277,7 +271,7 @@
1.26
1.27 def insertBefore(self, tmp, oldNode):
1.28 if tmp.nodeType == xml.dom.Node.TEXT_NODE:
1.29 - _child = tmp._text
1.30 + _child = tmp._node
1.31 elif tmp.nodeType == xml.dom.Node.ELEMENT_NODE:
1.32 _child = tmp._node
1.33 else:
1.34 @@ -287,7 +281,7 @@
1.35
1.36 def replaceChild(self, tmp, oldNode):
1.37 if tmp.nodeType == xml.dom.Node.TEXT_NODE:
1.38 - _child = tmp._text
1.39 + _child = tmp._node
1.40 elif tmp.nodeType == xml.dom.Node.ELEMENT_NODE:
1.41 _child = tmp._node
1.42 else:
1.43 @@ -297,7 +291,7 @@
1.44
1.45 def appendChild(self, tmp):
1.46 if tmp.nodeType == xml.dom.Node.TEXT_NODE:
1.47 - _child = self._node.addChild(tmp._text)
1.48 + _child = self._node.addChild(tmp._node)
1.49 elif tmp.nodeType == xml.dom.Node.ELEMENT_NODE:
1.50 _child = self._node.addChild(tmp._node)
1.51 else:
2.1 --- a/test.py Mon Oct 06 21:59:05 2003 +0000
2.2 +++ b/test.py Mon Oct 06 22:11:00 2003 +0000
2.3 @@ -1,11 +1,10 @@
2.4 #!/usr/bin/env python
2.5
2.6 import libxml2dom
2.7 -import libxml2
2.8 from xml.dom.ext import PrettyPrint
2.9 import sys
2.10
2.11 -doc = libxml2.parseFile(sys.argv[1])
2.12 +d = libxml2dom.parse(sys.argv[1])
2.13
2.14 #doc = libxml2.parseDoc("""<?xml version="1.0" encoding="iso-8859-15"?>
2.15 #<schema xmlns="http://www.boddie.org.uk/ns/xmltools/model"
2.16 @@ -15,7 +14,6 @@
2.17 #</schema>
2.18 #""")
2.19
2.20 -d = libxml2dom.Node(doc)
2.21 PrettyPrint(d)
2.22
2.23 # vim: tabstop=4 expandtab shiftwidth=4