[Qt-interest] Why is using XmlPatterns so cumbersome?

Jason H scorp1us at yahoo.com
Fri Mar 26 16:21:35 CET 2010


Thanks Frans! I looked for votes on the left panel...

Ok here's my contribution. I am leery about sharing code because I'm afraid I'll get laughed at. This code could be epically bad. In fact, I am sure it is! It probably contains bugs, and bugs that I don't even know about. I am also leery about sharing it because it might set a precedent for the wrong way of doing something. And it is lacking compiler optimizations.

But FWIW, here is a class I wrote to make searching/editing XML easy. It is meant to comply with XPath, but it only supports a limited sub-set (equality, and not other comparisons, or n-th), which is the subset I need it for.

2 files attached.


Examples:
XmlMapper srcMapper(source); // source is a QDomDocument
QList<QDomNode> msgIds = srcMapper.findChildNodes("Envelope/Header/MessageID");
if (msgIds.count()>0)
{
}
//////////
results =  doc->findChildNodes("Envelope/Body/Transaction/RegistryObjectList/ExtrinsicObject[@id='{docID}']/Slot[@name='UniqueId']"));
if (results.count())
{
}
///////////
QList<QDomNode> nl=DNLToQList(node.toElement().elementsByTagName("RegistryError"));
foreach (QDomNode e, nl)
{
       qDebug() << e.toElement().attribute("codeContext");
}





----- Original Message ----
From: Frans Englich <frans.englich at nokia.com>
To: qt-interest at trolltech.com
Cc: ext Jason H <scorp1us at yahoo.com>; "Oliver.Knoll at comit.ch" <Oliver.Knoll at comit.ch>
Sent: Fri, March 26, 2010 10:54:59 AM
Subject: Re: [Qt-interest] Why is using XmlPatterns so cumbersome?

On Friday 26 March 2010 15:37:06 ext Jason H wrote:
[...]

> re-work (I guess Phonon bombed?) and Creator 2.0. Generally Qt has

Currently not decided.

[...]
> I've voted for the XML bug though I swear I made one myself years ago.
> Anyway, its been a problem since 4.4...

Yes, I personally would like to see it myself, many have your sympathy. It's 
the unfortunate reality of priorities and man power, as usual :/

> Is there a way to see the bugs/issues with the highest votes?

You can do a search, and then press the Votes column, so you get the search 
sorted by number of votes.


Cheers,

        Frans



      
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xmlmapper.h
Url: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100326/0f62e63c/attachment.h 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmlmapper.cpp
Type: application/octet-stream
Size: 13729 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100326/0f62e63c/attachment.obj 


More information about the Qt-interest-old mailing list