Results 1 to 2 of 2

Thread: QtXml can't properly resolve xml with char "&" in it

  1. #1
    Join Date
    Jul 2010
    Posts
    20
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QtXml can't properly resolve xml with char "&" in it

    Qt Code:
    1. <program>
    2. <id>1306917122529</id>
    3. <starttime></starttime>
    4. <endtime></endtime>
    5. <layout><slide fileURL="E:/123&.jpg"/></layout>
    6. <title><![CDATA[1080*1920-ff]]></title>
    7. </program>
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. dom = QDomDocument()
    2. dom.setContent(xml)
    3. root=dom.documentElement()
    4. p_nodeList = dom.childNodes()
    5. i=0
    6. while i<p_nodeList.count():
    7. nodeList=p_nodeList.at(i).childNodes()
    8. print nodeList.count()
    9. i=i+1
    To copy to clipboard, switch view to plain text mode 
    i used above code to print the counts of the children of a program node, For xml with "&" in it ,output is 4, but if i delete "&", output is 5,so why this happen?

    sry for my english and thx in advance

  2. #2
    Join Date
    Mar 2009
    Location
    Belchatow, Poland
    Posts
    38
    Thanks
    11
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Re: QtXml can't properly resolve xml with char "&" in it

    Using ampersand in XML attributes is not allowed, see http://www.w3.org/TR/xhtml1/#C_12
    You should write "&amp;"

Similar Threads

  1. Replies: 11
    Last Post: 30th March 2015, 06:03
  2. Replies: 1
    Last Post: 28th November 2010, 17:16
  3. QProgressBar "crash" - doesn't work properly
    By metRo_ in forum Qt Programming
    Replies: 6
    Last Post: 23rd October 2010, 13:56
  4. Replies: 21
    Last Post: 20th October 2010, 13:25
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.