How to parse/write the attributes of a tag using QDomNode?
This is my XML
<File Width="" Name="../SupportFiles/TestVectors/10b- Cityscape [Landscape] 1 Min_1080p MP4.mp4" Height="" Format="" FrameRate=""/>
I should read only Name attribute of the FileName tag.How do I do this using QDom?How to write attributes using QDom?
how can i Write the above xml using XMLStreamWritter class.
For writing an attribute, if that's what you mean:
QXmlStreamWriter w = // ... QDomElement e = //... //... QDomAttr a = e.attributeNode("Name"); // ... w.writeAttribute(e.name(), e.value());
But now you're asking about
QXmlStreamWriter, which you weren't before. I don't know why you're mixing this with
QDom. Normally, you read everything with
QDom, maybe make some changes, and then write everything back with
QDom. Take a look at e.g. http://www.informit.com/articles/article.aspx?p=1405553&seqNum=4:
Using QXmlStreamWriter to write XML is the easiest and safest approach, but if we already have the XML in a DOM tree, we can simply ask the tree to output the relevant XML by calling save() on the QDomDocument object.