[Interest] Display XML in tree view

Murphy, Sean smurphy at walbro.com
Wed Aug 3 17:35:08 CEST 2016


> Keep in mind that XML files can have <![CDATA[ ... ]]> sections. Because of
> these and also different encodings etc., it would be quite hard to (always
> correctly) determine the tree-structure of an XML file on a purely textual
> level without actually parsing it.

Yep, thanks for pointing that out, and indeed my XML does contain CDATA.
By default QDomNode::nodeName() returns "#cdata" in those cases, which
might actually be ok for what I'm doing. I guess for completeness I should
handle that and allow the user to see it since my goal is to just have the user
be able to review the original XML within my app.

> So Jasons suggestion seems to be the best approach to me.
> Let the DOM Parser do all the hard work for you :-)

I definitely did that to build up the internal data tree hierarchy to populate the
model, and that was invaluable. Now it's just tweaking strings to get the view
to look just how I want it.

Sean











More information about the Interest mailing list