Results 1 to 1 of 1

Thread: Xpath & QT

  1. #1
    Join Date
    Oct 2010
    Posts
    95
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Xpath & QT

    Hi,

    I'm trying to use XPath with the QT libraries. For now I do the following :

    Qt Code:
    1. QXmlQuery query;
    2. query.bindVariable("inputURI", QVariant(filename));
    3.  
    4. query.setQuery("doc($inputURI)//aurora/scene/camera");
    5.  
    6. QXmlResultItems xppCamera;
    7. query.evaluateTo(&xppCamera);
    8. for (QXmlItem item = xppCamera.next(); !item.isNull(); item = xppCamera.next())
    9. {
    10. const QAbstractXmlNodeModel* model = item.toNodeModelIndex().model();
    11. ???
    12. }
    To copy to clipboard, switch view to plain text mode 

    So, I have 3 problems :
    1 - It seems that I never go inside the for loop !
    2 - How can I get an attribute. Something like this that will give me the value
    Qt Code:
    1. QString colorValue = item->Attribute("color") ;
    To copy to clipboard, switch view to plain text mode 
    3 - How can I get a "sub node" and recreate a new xquery on it. Something like this
    Qt Code:
    1. QXmlResultItems xppElements;
    2. QXmlQuery query2;
    3. query2.setQuery("subElements\element");
    4. query2.evaluate(xmlItem->Node(), xppElements);
    To copy to clipboard, switch view to plain text mode 

    Thanks for your help
    Last edited by Lykurg; 15th November 2010 at 14:14. Reason: changed [qtclass] to [code]

Similar Threads

  1. Generating XPath query
    By Superstrength in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2009, 19:48
  2. bug XPath in XSLT?
    By ixSci in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2009, 09:24
  3. XPath
    By steg90 in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2007, 22:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.