Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML and XML List Model

QML and XML List Model

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 3.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    preeman
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • P Offline
      P Offline
      preeman
      wrote on last edited by
      #2

      Ok, I think I got it, I was using /TubeToday/lines/line

      instead of /Lines/Line, big L not the small l :)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved