PDA

View Full Version : use QXmlStreamWrite to repair or delete one node.



wookoon
11th September 2010, 10:51
Now I use QXmlStreamWrite with qxml, it just can add elements to the file.

I have not found any way in document to repair or delete one element .

So Must I use dom to resolve it..?

ChrisW67
12th September 2010, 00:27
You can read the whole document into a QDOMDocument, modify it, and write it back to file. You could also parse the file with SAX (QXmlSimpleReader), modify the relevant parts as you reach them, and write back to another XML file. Which is more suitable depends on what you need to modify, how you need to modify it, and the size of the files. If the input is not well formed XML then you will not be able to use the DOM but you may be able to use SAX.