[PyQt] QXmlQuery example needed

Ruslan Popov ruslan.popov at gmail.com
Tue Jun 22 22:21:24 BST 2010


I have tried right now:

q_str = 'doc("/home/rad/project/qt/manager/uis/logic.xml")/logic/rule
query.setQuery(q_str)

also I have handler like this:

class Handler(QAbstractMessageHandler):
    def handleMessage(self, msg_type, desc, identifier, loc):
        print 'QUERY:', msg_type, desc, identifier, loc

and it responds this time:

QUERY: 3 <html xmlns='http://www.w3.org/1999/xhtml/'><body><p>syntax error,
unexpected &lt;number literal&gt;, expecting )</p></body></html>
PyQt4.QtCore.QUrl(u'http://www.w3.org/2005/xqt-errors#XPST0003')
<PyQt4.QtXmlPatterns.QSourceLocation object at 0x2204120>


On Tue, Jun 22, 2010 at 8:38 PM, David Boddie <dboddie at trolltech.com> wrote:

> On Tue Jun 22 07:03:51 BST 2010, Ruslan Popov wrote:
>
> > 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)
>
> Have you tried using an absolute path instead of "./uis/logic.xml"?
>
> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



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


More information about the PyQt mailing list