1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test.py Mon Sep 29 22:47:24 2003 +0000
1.3 @@ -0,0 +1,22 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +import libxml2dom
1.7 +import libxml2
1.8 +#doc = libxml2.parseFile("XMLTools2/examples/zoo/zoo_schema.xml")
1.9 +doc = libxml2.parseDoc("""<?xml version="1.0" encoding="iso-8859-15"?>
1.10 +<schema xmlns="http://www.boddie.org.uk/ns/xmltools/model"
1.11 + xmlns:database="http://www.boddie.org.uk/ns/xmltools/database">
1.12 +
1.13 + <def-element name="cage" database:table="CAGE"/>
1.14 +</schema>
1.15 +""")
1.16 +d = libxml2dom.Node(doc)
1.17 +
1.18 +# This works:
1.19 +print d.childNodes[0].childNodes[1]._node.nsProp("table", 'http://www.boddie.org.uk/ns/xmltools/database')
1.20 +print doc.children.children.next.nsProp("table", 'http://www.boddie.org.uk/ns/xmltools/database')
1.21 +# This works only with an appropriate patch to libxml2 2.5.7:
1.22 +print d.childNodes[0].childNodes[1].attributes[1]._node.ns()
1.23 +# Equivalent to:
1.24 +print d.childNodes[0].childNodes[1]._node.properties.next.ns()
1.25 +print doc.children.children.next.properties.next.ns()