Results 1 to 2 of 2

Thread: Writing an empty XML element using QxmlWriter APIs ?

  1. #1
    Join Date
    Apr 2014
    Posts
    125
    Qt products
    Qt5 Qt/Embedded
    Platforms
    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>


    Thanks;

    Mut.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    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?

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 30th November 2013, 12:03
  2. Replies: 9
    Last Post: 23rd April 2012, 14: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, 13:48
  4. Replies: 2
    Last Post: 24th July 2010, 10:41
  5. remove directory empty or not empty
    By raphaelf in forum Newbie
    Replies: 12
    Last Post: 27th October 2006, 08:30

Tags for this Thread

Bookmarks

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.