Solved XML read/write simultaneously
-
How to XML read/write simultaneously?
-
@Sherlin-N-G
you need to be more specific what you want to do...
Reading/writing from/to a file or stream, etc? -
@raven-worx I'm working on a project in which user enters some values in the ui to run the application and these values should be written on the xml file(which i was able to do with DOM) and the user has an option to load a default xml file and the values from this xml file should be read in my ui and user can make some changes and these changes should be written on my XML.
I'm able to do read and write of xml using dom but not simultaneously. -
@Sherlin-N-G
It still depends on just what you mean by "simultaneously". But the the normal way I would expect is that you read in the whole of an XML document into DOM, closing the file, do whatever editing, and finally write the new DOM back as a whole to the same/new file. -
@raven-worx How do I create a new xml file when some editing is done for the loaded XML file through the UI.
-
@Sherlin-N-G said in XML read/write simultaneously:
How do I create a new xml file when some editing is done for the loaded XML file through the UI.
- QDomDocument::toByteArray()
- write the bytearray to a QFile opened in
QIODevice::WriteOnly
mode