Results 1 to 3 of 3

Thread: How to read encoding type in XML file

  1. #1
    Join Date
    Apr 2006
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to read encoding type in XML file

    I’m new to QT so this is probably an easy thing to do, but I’ve not found a solution.

    I want to parse/read an XML document using DOM, and I would like to test the values of:

    <?xml version="1.0" encoding="ISO-8859-1" ?>

    How can I find out which version of XML & encoding type is used?

    Thanks

    Dan

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to read encoding type in XML file

    Qt doesn't seem to provide this functionality out of the box.
    You'll have to check processing instruction node's content manually.
    Check QDomDocument's child nodes for a "processing instruction" node and parse it's data content by yourself...

    Reference:
    QDomDocument
    QDomNode::isProcessingInstruction() / QDomNode::toProcessingInstruction()
    QDomProcessingInstruction::data() / QDomNode::nodeValue()
    J-P Nurmi

  3. #3
    Join Date
    Mar 2006
    Posts
    10
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to read encoding type in XML file

    You can simply use QRegExp

Similar Threads

  1. QFile can't read a file
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2009, 20:24
  2. [Java] read and write a file
    By mickey in forum General Programming
    Replies: 3
    Last Post: 22nd June 2008, 10:43
  3. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  4. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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.