×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    15

    XML parser and problem with content without CDATA

    Hi, I have built an xml parser and I have a problem. I cannot control the content with which the xml parser works and there are some xml documents that in tags like <content> have html tags elements, for example:

    Code:
    <content>
        <b>This is a <a href="http://www.sample.com">sample</a></b>
    </content>
    This content should be like this:

    Code:
    <content>
     <![CDATA[<b>This is a <a href="http://www.sample.com">sample</a></b>]]>
    </content>
    This way everything works ok, but as I said the problem is that I cannot control the xml documents, so in case there isn't a cdata section the xml parser interprets the html tags as other nodes and I would like to read everything that is in a content node as text.

    Now my c++ code looks like this:

    Code:
    if(n.nodeName() == "content"){
           if(!n.firstChild().isCDATASection()){
               qDebug() << "No CDATA";
               strDescription = ??????
           }else{
               qDebug() << "CDATA";
               strDescription = n.firstChild().nodeValue();
           }
    }
    So, how could I read everything there is in a content tag as text?
    Last edited by Sheenmue; 2011-06-14 at 20:00.

Similar Threads

  1. XML Parser Problem
    By nisheethpandey in forum Symbian
    Replies: 6
    Last Post: 2009-10-28, 11:08
  2. XML Parser Problem
    By Anurag Bansal in forum Symbian
    Replies: 3
    Last Post: 2009-02-05, 15:52
  3. problem with JSR 172 XML parser sax
    By madsum in forum Mobile Java General
    Replies: 1
    Last Post: 2009-01-07, 12:00
  4. kXML XML Parser versus Jsr172 API Parser
    By javame.developer in forum Mobile Java General
    Replies: 1
    Last Post: 2008-02-14, 20:23
  5. problem with the XML Parser SyExpat
    By Vitaly_iva in forum Symbian
    Replies: 2
    Last Post: 2006-06-05, 11:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×