PDA

View Full Version : Writing an empty XML element using QxmlWriter APIs ?



mut
20th June 2014, 03:13
Using QXMLWriter APIs, I wonder how to write an empty element (nothing between Start() and End() calls)?

Expected result is : <element></element>


Thanks;

Mut.

anda_skoa
20th June 2014, 08:39
Most XML writing APIs will not generate that but go for the more compact empty element syntax, i.e. <element />

But you can achieve that with QXmlStreamWriter::writeTextElement() and passing an empty string as the text to write.

What is your reason for needing the non-compact form?

Cheers,
_