PDA

View Full Version : problem with using xpath to query from xml file



aya_lawliet
7th September 2011, 16:38
Hi,

I've recently updated from QtSDK 1.1.1 to QtSDK 1.1.3

Before, I've created a simple program that reads from xml file and using xmlmodel query using xpath. Works just fine until I upgraded to QtSDK 1.1.3.

I used this simple program to test the xpath queries before:


Rectangle {
id: appWindow
width: 300; height: 300
color: "pink"

XmlListModel{
id: xmlmodel
source: "sample.xml"
query: "/story/pages/text[@id=\"1\"]"
// query: "/story/pages/text"

XmlRole { name: "content"; query: "string()" }
}

Component {
id: itemdelegate
Item {
id: wrapper
width: contentText.width
height: contentText.height
Text{ id: contentText; text: content; textFormat: Text.PlainText }
}
}

ListView {
id: listView
width: 200
height: 20
model: xmlmodel
delegate: itemdelegate
highlight: highlighter
highlightFollowsCurrentItem: true
orientation: "Horizontal"
}
}


The query property of XmlListModel, as far as i have observed, does not work in the current version of QtSDK (1.1.3). This makes the program to "unexpectedly finished". I have verified this by making the query to the one commented out.

I have used this code before using QtSDK 1.1.1, and it works just fine. I want to ask if this is a bug or xpath queries are just not supported in QtSDK 1.1.3? Because I have used xpath queries intensively in the application that I am developing.. :C

Thanks in advance~