[Qt-interest] Why is using XmlPatterns so cumbersome?
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Fri Mar 26 09:16:06 CET 2010
Jason H wrote on Thursday, March 25, 2010 6:22 PM:
> ...What I mean by that is, I cannot
> use XPath to find nodes, then modify the document using the
> XPath-found nodes.
>
> Ideally, QDomNode would take an XPath expression and return a
> QList<QDomNode> This would make searching and modifying the documents
> easy, as you could use a nested foreach() structure to handle your
> document processing.
> [...]
> Right now, the only way do this is to use
> QDomNode::firstChildElelement(), nextSiblingElement(), and
> lastChildElement() and then you have to compare each element's
> attributes on your own.
What's more, I remember a discussion here on qt-interest that QDomDocument is not receiving any more love these days and is likely to be dropped in Qt 5.0 (based on an article on http://labs.trolltech.com/ which I can't find anymore). Well, that's still a bit away from now, but probably a good time to start thinking how to modify XML data in the future.
> [...]
> There's no way to really search and replace in an XML document. The
> XQuery trick only gives you a new document, that you can't use to
> modify the original.
I am a bit surprised to hear that. I haven't touched the XMLPatterns module so far (I used the QDomDocument so far), but at least it seems to (partly) cover XSLT, so you can at least modify an existing XML document (and get a new one, which is okay for my use case that I have in mind: convert old documents to the latest version).
But I like your ideas very much and I hope the focus of Qt development does not get lost too much on "fancy widgets", but rather goes towards "core functionality" again.
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list