I am still looking for a solution to create a new DOM tree from an existing DOM tree by piecing together all the subtrees that are rooted at the nodes with the specified name. This shouldn’t be that hard! Ideally I would like my function to accept teo inputs ---- the original DOM and the node name ---- and it returns the new DOM. It would be better if these nodes are snipped from the original DOM tree. Can somebody help?
As a less preferred approach, I can live with a function that creates a new XML file. As you already know, I have already created a function that plucks the desired XML content from the original file and dumps it into another file. The problem is, of course, that the resultant file is ill-formed since it is missing not only the XML declaration statement but the root node as well. Based on David Bertoni's suggestion, I decided to add the missing markups and create a proper XML file. Here’s the pseudo code I used: 1). Open a new XML file and the ill-formed XML file (which is created by my function, as mentioned above) 2). Write the XML declaration statement to the new XML file 3). Write the root tag (opening) to the new XML file 4). Find the size of the ill-formed XML file 5). Break the contents of the ill-formed XML file into fixed sized blocks, plus "change" 6). Read the contents of the ill-formed XML file to the new XML file 7). Write the root tag (closing) to the new XML file 8). Close the new XML file and the ill-formed XML file The problem is that I am getting the error at step 4. For some reason, as long as the application is running, I keep getting the size of the ill-formed XML file as zero. The result is that the new XML file only contains the XML declaration statement and the root opening and closing tags. I verified this by halting the application (both with a cin statement and in the debugger) and doing an ls -l on the file. I moved my pseudo code to the very end of the application. I even invoked my pseudo code from atexi, but to no avail. Only after the application exits does the content appear in the ill-formed XML file. Any suggestions? I am all ears. Bhat -- View this message in context: http://www.nabble.com/Transferring-nodes-from-one-DOM-tree-to-another-------possible--tp14705312p14705312.html Sent from the Xerces - C - Users mailing list archive at Nabble.com.
