[PyQt] QXmlQuery.evaluate() does'nt accept QString parameter?

Olivier Fournier o.fournier at perigord.com
Tue Mar 23 15:34:39 GMT 2010


Hi,

I would like to use the overloaded function  QXmlQuery.evaluateTo (self, 
QString).
I raise this Error:
TypeError: arguments did not match any overloaded call:
  QXmlQuery.evaluateTo(QXmlResultItems): argument 1 has unexpected type 
'str'
  QXmlQuery.evaluateTo(QAbstractXmlReceiver): argument 1 has unexpected 
type 'str'
  QXmlQuery.evaluateTo(QIODevice): argument 1 has unexpected type 'str'

python version: 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 
bit (Intel)]
pyqt version : 4.6.1

I don't understand why.
Somebody could help me?
Thanks

Olivier Fournier

pyqt example:

import sys
print(sys.version)

from PyQt4.QtGui import QApplication
app = QApplication(sys.argv)

from PyQt4 import QtCore
print(QtCore.QT_VERSION_STR)

from PyQt4 import QtXmlPatterns


doc_xml = """<?xml version="1.0" encoding="UTF-8"?>
<DOC>
 <TAG>blue</TAG>
 <TAG>red</TAG>
 <TAG>green</TAG>
</DOC>"""

doc_xsl = """<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" 
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" version="2.0">
    <xsl:output method="xml" encoding="UTF-8"/>
    <xsl:template match="/">
        <xsl:copy-of select="/DOC"/>
    </xsl:template>
</xsl:stylesheet>"""


doc_xslt = ""

query = QtXmlPatterns.QXmlQuery(QtXmlPatterns.QXmlQuery.XSLT20)
query.setFocus(doc_xml)
query.setQuery(doc_xsl)

query.evaluateTo(doc_xslt)

print(doc_xslt)




More information about the PyQt mailing list