# HG changeset patch # User paulb # Date 1104193203 0 # Node ID 6dc926cb0dc9388d1acff20e98be2cbc1d33cc8b # Parent 85f58d31ffd59117ead6ddcc86354e6a902ac646 [project @ 2004-12-28 00:20:03 by paulb] Moved tests/prettyprint.py from test.py. Added a test of node importing. diff -r 85f58d31ffd5 -r 6dc926cb0dc9 tests/importnode.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/importnode.py Tue Dec 28 00:20:03 2004 +0000 @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import libxml2dom +import sys + +d = libxml2dom.parse(sys.argv[1]) +root = d.xpath("*[1]")[0] +d2 = libxml2dom.createDocument(None, "new", None) +root2 = d2.xpath("*[1]")[0] +for i in range(0, 10): + imported = d2.importNode(root, 1) + root2.appendChild(imported) +libxml2dom.toStream(d2, sys.stdout) +del root2 +_d2 = d2.as_native_node() +del d2 +_d2.freeDoc() +del root +_d = d.as_native_node() +del d +_d.freeDoc() + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 85f58d31ffd5 -r 6dc926cb0dc9 tests/prettyprint.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/prettyprint.py Tue Dec 28 00:20:03 2004 +0000 @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import libxml2dom +from xml.dom.ext import PrettyPrint +import sys + +d = libxml2dom.parse(sys.argv[1]) +PrettyPrint(d) + +# vim: tabstop=4 expandtab shiftwidth=4