Results 1 to 4 of 4

Thread: special characters in xml

  1. #1
    Join Date
    May 2008
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default special characters in xml

    how can I read special characters from xml. any sample code will help me much,,, thanks in advance.
    my xml structure is like--

    <?xml version="1.0" encoding="UTF-8"?>
    <settings>
    <english>
    <one>.,?!1@'-_():;&/%*#+<=>¡¿</one>
    <two>abc2äåæà áâãç</two>
    <three>def3éèëêð</three>
    </english>
    <bangla>
    <one>"2"</one>
    </bangla>
    </settings>

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: special characters in xml

    characters are characters,, right ?
    What have you tried to read the xml ?
    QDomElement, QDomNodewill be useful

  3. #3
    Join Date
    May 2008
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: special characters in xml

    QDomDocument doc;
    doc.setContent(&file);
    QDomElement root = doc.documentElement();
    QDomNode n = root.firstChild();

    while( !n.isNull() )
    {
    QDomElement e = n.toElement();
    if( !e.isNull() )
    {
    if( e.tagName() == "english" )
    {
    QDomElement sr =e.firstChildElement("two");
    qDebug()<<sr.text();
    }
    }
    n = n.nextSibling();
    }

    I tried using Qdom, but it works only if there is no special character,, Am I doing something wrong..

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: special characters in xml

    What does "works" mean in this case exactly? Could you post that example XML file as an attachment?

Similar Threads

  1. Special characters in Html blocks
    By giusepped in forum Qt Programming
    Replies: 4
    Last Post: 27th October 2008, 08:13
  2. QtXml and special characters
    By supergillis in forum Qt Programming
    Replies: 4
    Last Post: 29th September 2008, 17:44
  3. Problem extracting special characters from DB
    By mourad in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2008, 07:59
  4. Problem at time compilation in traslation of language
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2007, 14:18
  5. Using special characters in QT dialogs
    By hvengel in forum Qt Tools
    Replies: 2
    Last Post: 10th April 2007, 00:32

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.