[Qt-interest] complete QDomNode to QString

Bo Thorsen bo at fioniasoftware.dk
Thu Apr 21 09:10:20 CEST 2011


Den 20-04-2011 16:40, Eckhard Jokisch skrev:
> Hi,
> I have the following XML-data in a QDomDocument:
>
> <THE-VALUE>
> 	<foo-xhtml:h1>
> 		This is an object.
> 	</foo-xhtml:h1>
> </THE-VALUE>
>
>
> Now I want to have
> 	"<foo-xhtml:h1>
> 		This is an object.
> 	</foo-xhtml:h1>"
>
> in a QString to pass it on to a QWebView which should show this as a heading.
>
> This is what I tried but it only stores "This is an object" in QString value:
>
> QDomNode node; //node contains the parent node of "<THE-VALUE>
> QString value;
> value=node.firstChildElement("THEVALUE").firstChild().toElement().text();
>
> How do I get the "foo-xhtml:h1" tag also into the string?

You can find a discussion about this topic here:

http://www.fioniasoftware.dk/blog/?p=70

It has my own suggestion as well as a couple of improvements from the 
readers.

I hope this helps.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Qt-interest-old mailing list