Problem with text nodes in XML...

   2542   3   0
User Avatar
Member
98 posts
Joined: 9月 2008
Offline
Hi,

Although I've found a different way of doing it, I've found a small problem with the XML parser in Python When I want to read text files, I cannot access the text inside. An example

<test>
<text>texttoread</text>
</test>

and a simple python code

from xml.dom import minidom, Node

def testText()
openedFile = open('L/dagush/src/XMLShape/test.xml')
content = openedFile.read()
xmltree = minidom.parseString(content)

print "going to print!"
print xmltree.getElementsByTagName('text')[0].firstChild.data

As I said, I decided not to use text nodes anymore, but I'm still interested in a solution…

cheers and thanks for everything

dagush.-
————————-
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
User Avatar
Member
7720 posts
Joined: 7月 2005
Offline
Since this is a purely Python issue, you might be better served contacting its mailing list and/or googling for “python minidom”.
User Avatar
Member
98 posts
Joined: 9月 2008
Offline
Ups! Sorry! From your answer I infer houdini uses the “standard” python engine, and does not have a brand new one. -)

thanks for the answer, anyway!

cheers

dagush.-
————————-
* skylineEngine project coordinator
* buildingEngine module developer
http//ggg.udg.edu/skylineEngine
User Avatar
Member
7720 posts
Joined: 7月 2005
Offline
The Houdini-specific parts are everything inside hou.*
  • Quick Links