Important: Please read the Qt Code of Conduct -

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)


    • <Header>
      <Identifier>Tfl | Service update - tube</Identifier>
      <DisplayTitle>Tfl | Service update - tube</DisplayTitle>
      <PublishDateTime>Fri, 06 May 2011 00:49:00 +01:00</PublishDateTime>
      <Owner>Transport for London</Owner>
      <Schedule>Every minute</Schedule>
      <OverrideMessage />
      <ErrorMessage />
      <FeedInfo>Developer information regarding the current state of the feed. Not to be displayed.</FeedInfo>

    However nothing is loaded into the model using:
    XmlListModel {
    id: tubethisweekendModel
    namespaceDeclarations: "declare default element namespace '';"
    source: ""
    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.


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

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

Log in to reply