Results 1 to 2 of 2

Thread: Writing an empty XML element using QxmlWriter APIs ?

  1. #1
    Join Date
    Apr 2014
    Qt products
    Qt5 Qt/Embedded
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Question Writing an empty XML element using QxmlWriter APIs ?

    Using QXMLWriter APIs, I wonder how to write an empty element (nothing between Start() and End() calls)?

    Expected result is : <element></element>



  2. #2
    Join Date
    Jan 2006
    Graz, Austria
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Unix/X11 Windows

    Default Re: Writing an empty XML element using QxmlWriter APIs ?

    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?


Similar Threads

  1. Replies: 1
    Last Post: 30th November 2013, 11:03
  2. Replies: 9
    Last Post: 23rd April 2012, 13:53
  3. Problem while using the S60 extension APIs and the Qt Mobility APIs
    By sudhir.linux in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd January 2011, 12:48
  4. Replies: 2
    Last Post: 24th July 2010, 09:41
  5. remove directory empty or not empty
    By raphaelf in forum Newbie
    Replies: 12
    Last Post: 27th October 2006, 07:30

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.