Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
minidom appendChild confusion
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Marco, post: 1839148"] Hello! Can anyone explain why the following code does not work? (I'm using python2.4.) Cheers, Marco -- # the following code does _not_ work. # intended: put child-nodes as children to another node from xml.dom.minidom import Document doc = Document() node1 = doc.createElement('one') el1 = doc.createElement('e1') el2 = doc.createElement('e1') node1.appendChild(el1) node1.appendChild(el2) assert 2 == len(node1.childNodes) # ok doc2 = Document() node2 = doc2.createElement('two') for el in node1.childNodes: node2.appendChild(el) assert 2 == len(node2.childNodes), "node2 has an unexpected number of children" [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
minidom appendChild confusion
Top