xml parsing escape characters

Luis P. Mendes luisXX_lupe2XX at netvisaoXX.pt
Thu Jan 20 08:05:59 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

this is the xml document:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www......"><DataSet>
~   <Order>
~     <Customer>439</Customer>
	(... others ...)
~   </Order>
</DataSet></string>

When I do:

print xmldoc.toxml()

it prints:
<?xml version="1.0" ?>
<string xmlns="http://www..."><DataSet>
~  <Order>
~    <Customer>439</Customer>

~  </Order>
</DataSet></string>

__________________________________________________________
with: 	stringNode = xmldoc.childNodes[0]
	print stringNode.toxml()
I get:
<string xmlns="http://www......."><DataSet>
~  <Order>
~    <Customer>439</Customer>

~  </Order>
</DataSet></string>
______________________________________________________________________

with:	DataSetNode = stringNode.childNodes[0]
	print DataSetNode.toxml()

I get:

<DataSet>
~  <Order>
~    <Customer>439</Customer>

~  </Order>
</DataSet>
_______________________________________________________________-

so far so good, but when I issue the command:

print DataSetNode.childNodes[0]

I get:
IndexError: tuple index out of range

Why the error, and why does it return a tuple?
Why doesn't it return:
	<Order>
	    <Customer>439</Customer>

	</Order>
??
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB76y3Hn4UHCY8rB8RAvQsAKCFD/hps8ybQli8HAs3iSCvRjwqjACfS/12
5gctpB91S5cy299e/TVLGQk=
=XR2a
-----END PGP SIGNATURE-----



More information about the Python-list mailing list