[PyQt] QXmlQuery example needed

Ruslan Popov ruslan.popov at gmail.com
Tue Jun 22 07:03:51 BST 2010


Hi all,

Can someone explain me how to use QXmlQuery. I have simple XML file on the
filesystem and I need to get one piece of it. My code following:

        out = QString()
        query  = QXmlQuery()
        query.setMessageHandler(handler)
        q_str = 'doc("./uis/logic.xml")/logic/rule'
        query.setQuery(q_str)

        if not query.isValid():
            print 'not valid'

        if not query.evaluateTo(out):
            print 'not evaluated'

It shows me 'not evaluated' for:

<?xml version="1.0" encoding="UTF-8"?>
<logic name="card_types" version="1.0">
  <rule name="flyer">
    <sequence/>
  </rule>
  <rule name="test">
    <sequence>
      <dialog type="list" name="category"/>
    </sequence>
  </rule>
</logic>

-- 
Ruslan Popov
phone: +7 916 926 1205
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100622/c87c8bd8/attachment.html>


More information about the PyQt mailing list