Copying Elements using PyXML

Jeremy Rew huxley1 at westnet.com.au
Tue Sep 24 07:15:28 EDT 2002


I have 2 XML documents. I would like to copy the entire structure of one 
document into a child element of the other, but i cannot copy the root node 
across:
I get the following error from Zope:
Error Type: HierarchyRequestErr
Error Value: Node manipulation results in invalid parent/child relationship.

the structures are as follows:

<person>
         <name/>
         <address/>
         <phone/>
</person>

and would like to copy this into the following format:

<xformimport>
         <docID col="blah" id="blahblah"/>
         <document>
                 <person>
                         <name/>
                         <address/>
                         <phone/>
                 </person>
         </document>
</xformimport>

I have written all the code to build 'xformimport','docID' and 'document', 
but just need to copy 'person' across.
I figure i may be missing an easy solution here, so any help/ideas will be 
appreciated.
I am using PyXML 0.8.1 and python 2.1.3.

thanks
Jeremy





More information about the Python-list mailing list