QML and XML List Model
-
Hi All,
This is my first post and I am currently stuck as I do not have enough knowldge about working with XML. I have been able to load a few XML feeds into XmlListModel however I am having problems with this one. (Third feed that I need)@
- <TubeToday xsi:NoNamespaceSchemaLocation="http://www.tfl.gov.uk/tfl/feeds/TubeToday_v1.xsd" version="200102231620" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <Header>
<Identifier>Tfl | Service update - tube</Identifier>
<DisplayTitle>Tfl | Service update - tube</DisplayTitle>
<Version>1</Version>
<PublishDateTime>Fri, 06 May 2011 00:49:00 +01:00</PublishDateTime>
<Author>webteam@tfl.gov.uk</Author>
<Owner>Transport for London</Owner>
<RefreshRate>1</RefreshRate>
<Max_Latency>2</Max_Latency>
<TimeToError>5</TimeToError>
<Schedule>Every minute</Schedule>
<OverrideMessage />
<ErrorMessage />
<FeedInfo>Developer information regarding the current state of the feed. Not to be displayed.</FeedInfo>
- <Attribution>
<Url>http://www.tfl.gov.uk</Url>
<Text>copyright TfL</Text>
<Logo>http://www.tfl.gov.uk/tfl-global/images/roundel.gif</Logo>
</Attribution>
<Language>en</Language>
</Header> - <Lines>
- <Line>
<Name>Bakerloo</Name>
<Colour>FFF</Colour>
<BgColour>AE6118</BgColour>
<Url>http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html</Url> - <Status>
<Text>Part closure</Text>
<Colour>FFF</Colour>
<BgColour>113B92</BgColour> - <Message>
<Text>Sunday 8 May, no service between Queen's Park and Harrow & Wealdstone. Replacement buses operate.</Text>
<Colour>FFF</Colour>
<BgColour>000</BgColour>
</Message>
</Status>
</Line>
</Lines>
</TubeToday>
@
However nothing is loaded into the model using:
@
XmlListModel {
id: tubethisweekendModel
namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2001/XMLSchema-instance';"
source: "http://www.tfl.gov.uk/tfl/businessandpartners/syndication/feed.aspx?email=///&feedId=1"
query: "/TubeToday/lines/line"
XmlRole { name: "linenameweekend"; query: "Name/string()" }
XmlRole { name: "linebgcolourweekend"; query: "BgColour/string()" }
}
@*I am sure that my namespaceDeclarations is wrong, I am not sure what to do with "NoNamespaceSchemaLocation". * I have tried a few combination but I really have no idea. I hope someone can help here.
Thanks,
MJ