qt-interest@trolltech.com
[Top] [All Lists]

Extracting with XML classes

Subject: Extracting with XML classes
From: Mini Chate
Date: Sun, 23 Oct 2005 08:43:44 -0400
Hello,
I'm trying to extract the <body> data out of a textedit box using the Qt XML
classes. So far though, I haven't had any luck in getting all the data --
its extracting only the text, or extracting nothing at all.

This is what I currently have:
QDomNode bodynode = n.firstChild();
while ( !bodynode.isNull() ) {
        if (( bodynode.isElement() ) && ( bodynode.nodeName() == "body") ) {
                QDomDocument e = bodynode.toDocument();
                qDebug("data" + e.toString());
                bodyTextStripped = e.toString();
                break;
        }
        bodynode = bodynode.nextSibling();
}
... (other code)
QDomText bodyText = doc.createCDATASection(bodyTextStripped);
... (and so on...)

It is creating the CDATA properly, but will strip out ALL tags from the
textedit box. For example if the textedit has <p>hello
<strong>foo</strong></p> in it, it writes only "hello foo".

Any help? Thanks!
Christopher Troup <ctroup@xxxxxx>

--
To unsubscribe - send "unsubscribe" in the body to 
qt-interest-request@xxxxxxxxxxxxx
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>
  • Extracting with XML classes, Mini Chate <=