1.1 --- a/__init__.py Sun Oct 05 23:49:54 2003 +0000
1.2 +++ b/__init__.py Mon Oct 06 18:59:57 2003 +0000
1.3 @@ -101,6 +101,10 @@
1.4 self._node = node
1.5 self.ownerElement = ownerElement
1.6
1.7 + # NOTE: Fix the doctype.
1.8 +
1.9 + self.doctype = None
1.10 +
1.11 def _ownerDocument(self):
1.12 return self._node.doc
1.13
1.14 @@ -260,7 +264,7 @@
1.15 _child = self._add_node(tmp)
1.16 return Node(_child)
1.17
1.18 - #doctype = property(_doctype)
1.19 + #doctype defined in __init__
1.20 #ownerElement defined in __init__
1.21 ownerDocument = property(_ownerDocument)
1.22 childNodes = property(_childNodes)
2.1 --- a/test.py Sun Oct 05 23:49:54 2003 +0000
2.2 +++ b/test.py Mon Oct 06 18:59:57 2003 +0000
2.3 @@ -3,22 +3,19 @@
2.4 import libxml2dom
2.5 import libxml2
2.6 from xml.dom.ext import PrettyPrint
2.7 +import sys
2.8
2.9 -#doc = libxml2.parseFile("XMLTools2/examples/zoo/zoo_schema.xml")
2.10 -doc = libxml2.parseDoc("""<?xml version="1.0" encoding="iso-8859-15"?>
2.11 -<schema xmlns="http://www.boddie.org.uk/ns/xmltools/model"
2.12 - xmlns:database="http://www.boddie.org.uk/ns/xmltools/database">
2.13 +doc = libxml2.parseFile(sys.argv[1])
2.14
2.15 - <def-element name="cage" database:table="CAGE"/>
2.16 -</schema>
2.17 -""")
2.18 +#doc = libxml2.parseDoc("""<?xml version="1.0" encoding="iso-8859-15"?>
2.19 +#<schema xmlns="http://www.boddie.org.uk/ns/xmltools/model"
2.20 +# xmlns:database="http://www.boddie.org.uk/ns/xmltools/database">
2.21 +#
2.22 +# <def-element name="cage" database:table="CAGE"/>
2.23 +#</schema>
2.24 +#""")
2.25 +
2.26 d = libxml2dom.Node(doc)
2.27 +PrettyPrint(d)
2.28
2.29 -# This works:
2.30 -print d.childNodes[0].childNodes[1]._node.nsProp("table", 'http://www.boddie.org.uk/ns/xmltools/database')
2.31 -print doc.children.children.next.nsProp("table", 'http://www.boddie.org.uk/ns/xmltools/database')
2.32 -# This works only with an appropriate patch to libxml2 2.5.7:
2.33 -print d.childNodes[0].childNodes[1].attributes.values()[1]._node.ns()
2.34 -# Equivalent to:
2.35 -print d.childNodes[0].childNodes[1]._node.properties.next.ns()
2.36 -print doc.children.children.next.properties.next.ns()
2.37 +# vim: tabstop=4 expandtab shiftwidth=4