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. parsing XML with XmlListModel
Forum Updated to NodeBB v4.3 + New Features

parsing XML with XmlListModel

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 145 Views 1 Watching
  • 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.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by filipdns
    #1

    Hello,

    I'm trying to parse XML with:

       XmlListModel {
            id: l1Item
            source: "file:///D:/txtav/1View/libraries/ml-b-200/b200mm/32/323137_5.xml"
            query:"/pgblk/list1/l1item/list2/l2item"
            property bool ready: false
            
            XmlRole { name: "columnValue"; query: "string()" }
    
            onStatusChanged:  {
                ready = (status == XmlListModel.Ready)
                if(ready)
                {
                    entrycount=count
                    //read ()
    
                  console.log(count)
                    for (var i=0;i<count;i++)
                    {
                        var columnValue=l1Item.get(i).columnValue
                        console.log("i: "+i+" entry: "+entry+"columnValue: "+columnValue)
    
                    }
                }
            }
        }
    

    with this code I get text but not only the l2item but l2item + all child of l2item (l2item +list3+l3item+caution+...)

    the XML has to be parse is like:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE pgblk SYSTEM "../../combined-XML.dtd"
    [ ]>
    <pgblk chapnbr="05" chg="n" convert2xml_version="" dataversion="2.0" ear-class="9E991" export-control="ear" gentext="INSPECTION/CHECK" id="b200mm-051100pb601r0" issue="E" manual-type="mm" model="200" pgblknbr="6" pubnumber="b200mm" revlevel="0" sectnbr="11" special-handling="none" subjnbr="00">
    <hotlink targetid="b200mm-051100pb601r0"></hotlink>
    <chgdesc revbar="t"><unlist revbar="t"><unlitem revbar="t"><para revbar="t">Inspection program standardization.</para></unlitem></unlist></chgdesc><title>OVERHAUL AND REPLACEMENT SCHEDULE</title>
    <list1>
    <hotlink targetid="b200mm-051100pb601_bm01"></hotlink>
    <l1item gentext="1." id="b200mm-051100pb601_bm01"><para>Overhaul and Replacement Schedule</para>
    <list2>
    <l2item gentext="A."><para>General</para>
    <list3>
    <l3item gentext="(1)"><para>The first overhaul and replacement must be performed not later than the recommended period. The condition of the item at the end of the first period can be used as a criterion for determining subsequent periods applicable to the individual airplane or fleet operation, provided the operator has an approved condition-monitoring system.</para>
    </l3item>
    <l3item gentext="(2)"><para>The time periods for overhaul and replacement noted in this manual are based on average usage and average environmental conditions.</para>
    </l3item>
    <l3item gentext="(3)"><para>If a system is opened, disconnected or changed in anyway, perform an operational check of the system.</para>
    </l3item>
    <caution><para>The recommended periods do not constitute a guarantee the item will reach the period without malfunction as the aforementioned factors cannot be controlled by the manufacturer.</para>
    </caution>
    <note><para>The date on the &quot;ORIGINAL AIRWORTHINESS CERTIFICATE&quot;, FAA Form No. 8100-2, which is issued with each new airplane, is to be used as the basis for all TBO or replacement components listed in the following schedule. </para></note><note><para>Textron Aviation Inc. (TAI) recommends that operators record the number of cycles used on individual components for purposes of complying with inspections based on cycle count.</para></note><l3item gentext="(4)"><para>For purposes of establishing intervals listed hereafter, the experience of Textron Aviation Inc. (TAI) indicates that each component experiences approximately one cycle per airplane flight hour in normal operation.</para>
    </l3item>
    <l3item gentext="(5)"><para>Items not listed in the Overhaul and Replacement Schedule are to be overhauled or replaced &quot;On Condition&quot;. If &quot;On Condition&quot; items are worn, inoperative, inaccurate, intermittent and are not repairable through normal maintenance practices, they must be overhauled or replaced.</para></l3item>
    </list3></l2item>
    </list2></l1item>
    </list1></pgblk>
    

    How can I have para only of the requested line?...

    Thank a lot for your help

    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