I used DOM to parse a XML file. I find a specified tag and add some childnodes under it. Then I called save() to convert the tree back to XML.
Pronlem is like this:
Original XML file:
[HTML]<doc>
<quote>Ars longa vita brevis</quote>
<translation>Art is long, life is short</translation>
</doc>[/HTML]
After modified the tree in memory and called save():
[HTML]<doc>
<quote>Ars longa vita brevis</quote>
<translation>Art is long, life is short</translation>
</doc>
<doc>
<quote>Ars longa vita brevis</quote>
<translation>Art is long, life is short</translation>
<translation2>Art is long, life is short</translation2>
</doc>[/HTML]
The original file is duplicated!
Any hint is appreciated!




Reply With Quote
Bookmarks