locked
Retrieving data from multiple child nodes in XML file RRS feed

  • Question

  • I have an xml file where each parent node may have 0 or multiple child nodes. My Linq to xml using the where statement only returns the first child node

     and I would like to retrieve all the child nodes.

    Any help would be appreciated.

    Attached is my code & the data file:

     

    Dim q1 = _

     

    From c In xmlDoc.<NewDataSet>.<Header> _

     

    Where (c.<Tech>.<idworkorder>.Value = a_id_workorder) _

     

    Select techName = c.<Tech>.<namtech>.Value _

    , store = c.

    <Tech>.<idstore>.Value _

    , dtcLastSync = c.

    <Tech>.<dtcLastSync>.Value()

     

    <?xml version="1.0" standalone="yes"?>
    <NewDataSet>
      <Header>
        <Workorder>0FD1007</Workorder>
        <Cust>90FNONC </Cust>
        <Name>NONCHARGE TIME - FIELD</Name>
        <Mk xml:space="preserve">  </Mk>
        <Model />
        <Serial />
        <UnitNo xml:space="preserve"> </UnitNo>
        <Dispatcher />
        <Type>Mly,</Type>
        <SF>S &amp; F</SF>
        <Loc />
        <Reason xml:space="preserve"> </Reason>
        <DateOpen>2010/06/30</DateOpen>
        <DatePrm xml:space="preserve">          </DatePrm>
        <Followup xml:space="preserve">          </Followup>
        <Div>G</Div>
        <JC>JQ</JC>
        <JobDesc />
        <Direction />
        <Urgency xml:space="preserve"> </Urgency>
        <DSLL>3</DSLL>
        <TechList>BILL BOLYARD, BOB LESLIE, DAN COX, DAVE MCNEAL, ED ENGLEKING</TechList>
        <Pty>99</Pty>
        <Done xml:space="preserve"> </Done>
        <Status>Scheduled</Status>
        <store>00</store>
        <indAG>N</indAG>
        <indCOD>N</indCOD>
        <indIncremental>N</indIncremental>
        <indMonthly>Y</indMonthly>
        <indPIPPSP>N</indPIPPSP>
        <indPM>N</indPM>
        <indRevenue>N</indRevenue>
        <indStartup>N</indStartup>
        <indWarranty>N</indWarranty>
        <indMultiDept>N</indMultiDept>
        <indContract>N</indContract>
        <indOthers>N</indOthers>
        <Tech>
          <idworkorder>0FD1007</idworkorder>
          <idtech>1798</idtech>
          <namtech>BILL BOLYARD</namtech>
          <idstore>40</idstore>
          <dtcLastSync>2010-07-19T07:40:18-05:00</dtcLastSync>
          <custreq>N</custreq>
          <revisitreason />
        </Tech>
        <Tech>
          <idworkorder>0FD1007</idworkorder>
          <idtech>2674</idtech>
          <namtech>BOB LESLIE</namtech>
          <idstore>40</idstore>
          <dtcLastSync>2010-07-16T18:50:09-05:00</dtcLastSync>
          <custreq>N</custreq>
          <revisitreason />
        </Tech>
        <Tech>
          <idworkorder>0FD1007</idworkorder>
          <idtech>1243</idtech>
          <namtech>DAN COX</namtech>
          <idstore>40</idstore>
          <dtcLastSync>2010-07-17T16:32:30-05:00</dtcLastSync>
          <custreq>N</custreq>
          <revisitreason />
        </Tech>
        <Tech>
          <idworkorder>0FD1007</idworkorder>
          <idtech>1416</idtech>
          <namtech>DAVE MCNEAL</namtech>
          <idstore>40</idstore>
          <dtcLastSync>2010-07-18T19:18:55-05:00</dtcLastSync>
          <custreq>N</custreq>
          <revisitreason />
        </Tech>
      </Header>
      <Header>
        <Workorder>FS07983</Workorder>
        <Cust>5100950 </Cust>
        <Name>ALLIED WASTE/NEWTON CO LANDF</Name>
        <Mk>AA</Mk>
        <Model>836H</Model>
        <Serial>0BXD00637</Serial>
        <UnitNo xml:space="preserve"> </UnitNo>
        <Dispatcher />
        <Type>Rev,</Type>
        <SF>SHOP</SF>
        <Loc />
        <Reason>DLL &gt; 4</Reason>
        <DateOpen>2010/06/10</DateOpen>
        <DatePrm xml:space="preserve">          </DatePrm>
        <Followup xml:space="preserve">          </Followup>
        <Div>G</Div>
        <JC>JP</JC>
        <JobDesc>lift cylinder</JobDesc>
        <Direction />
        <Urgency xml:space="preserve"> </Urgency>
        <DSLL>27</DSLL>
        <TechList />
        <Pty>99</Pty>
        <Done xml:space="preserve"> </Done>
        <Status>Working</Status>
        <store>00</store>
        <indAG>N</indAG>
        <indCOD>N</indCOD>
        <indIncremental>N</indIncremental>
        <indMonthly>N</indMonthly>
        <indPIPPSP>N</indPIPPSP>
        <indPM>N</indPM>
        <indRevenue>Y</indRevenue>
        <indStartup>N</indStartup>
        <indWarranty>N</indWarranty>
        <indMultiDept>N</indMultiDept>
        <indContract>N</indContract>
        <indOthers>N</indOthers>
      </Header>
      <Header>
        <Workorder>FS08036</Workorder>
        <Cust>4572200 </Cust>
        <Name>MARTIN MARIETTA #25111</Name>
        <Mk>AA</Mk>
        <Model>988H</Model>
        <Serial>0BXY01332</Serial>
        <UnitNo xml:space="preserve"> </UnitNo>
        <Dispatcher />
        <Type>Rev,</Type>
        <SF>FIELD</SF>
        <Loc>KY AVE</Loc>
        <Reason>DLL &gt; 4</Reason>
        <DateOpen>2010/06/14</DateOpen>
        <DatePrm xml:space="preserve">          </DatePrm>
        <Followup xml:space="preserve">          </Followup>
        <Div>G</Div>
        <JC>JQ</JC>
        <JobDesc>R &amp; I Transmission &amp; Transfer case</JobDesc>
        <Direction>shop is done 7/15</Direction>
        <Urgency>2 - High</Urgency>
        <DSLL>19</DSLL>
        <TechList>DAVE MCNEAL, SHANE SEIDLER</TechList>
        <Pty>99</Pty>
        <Done xml:space="preserve"> </Done>
        <Status>Complete</Status>
        <store>00</store>
        <indAG>N</indAG>
        <indCOD>N</indCOD>
        <indIncremental>N</indIncremental>
        <indMonthly>N</indMonthly>
        <indPIPPSP>N</indPIPPSP>
        <indPM>N</indPM>
        <indRevenue>Y</indRevenue>
        <indStartup>N</indStartup>
        <indWarranty>N</indWarranty>
        <indMultiDept>N</indMultiDept>
        <indContract>N</indContract>
        <indOthers>N</indOthers>
        <Tech>
          <idworkorder>FS08036</idworkorder>
          <idtech>1416</idtech>
          <namtech>DAVE MCNEAL</namtech>
          <idstore>40</idstore>
          <dtcLastSync>2010-07-18T19:18:55-05:00</dtcLastSync>
          <custreq>N</custreq>
          <revisitreason />
        </Tech>
        <Tech>
          <idworkorder>FS08036</idworkorder>
          <idtech>1941</idtech>
          <namtech>SHANE SEIDLER</namtech>
          <idstore>40</idstore>
          <dtcLastSync>2010-07-16T15:36:28-05:00</dtcLastSync>
          <custreq>N</custreq>
          <revisitreason />
        </Tech>
      </Header>
      <Header>
        <Workorder>FS08230</Workorder>
        <Cust>2008250 </Cust>
        <Name>DELELLO &amp; SONS ASPHALT</Name>
        <Mk>AA</Mk>
        <Model>CB24</Model>
        <Serial>024000423</Serial>
        <UnitNo xml:space="preserve"> </UnitNo>
        <Dispatcher />
        <Type>Rev,War,</Type>
        <SF>S &amp; F</SF>
        <Loc>Midhoffer &amp; Pendelton Pike by LA Fitness</Loc>
        <Reason>DLL &gt; 4</Reason>
        <DateOpen>2010/06/24</DateOpen>
        <DatePrm xml:space="preserve">          </DatePrm>
        <Followup xml:space="preserve">          </Followup>
        <Div>G</Div>
        <JC>JP</JC>
        <JobDesc>Ck/Rep Trans, Will NOTgo into REV</JobDesc>
        <Direction>Jeff: 317-502-2580</Direction>
        <Urgency>3 - Medium</Urgency>
        <DSLL>7</DSLL>
        <TechList />
        <Pty>99</Pty>
        <Done xml:space="preserve"> </Done>
        <Status>Complete</Status>
        <store>00</store>
        <indAG>N</indAG>
        <indCOD>N</indCOD>
        <indIncremental>N</indIncremental>
        <indMonthly>N</indMonthly>
        <indPIPPSP>N</indPIPPSP>
        <indPM>N</indPM>
        <indRevenue>Y</indRevenue>
        <indStartup>N</indStartup>
        <indWarranty>Y</indWarranty>
        <indMultiDept>N</indMultiDept>
        <indContract>N</indContract>
        <indOthers>N</indOthers>
        <Tech>
          <idworkorder>FS08230</idworkorder>
          <idtech>2674</idtech>
          <namtech>BOB LESLIE</namtech>
          <idstore>40</idstore>
          <dtcLastSync>2010-07-16T18:50:09-05:00</dtcLastSync>
          <custreq>N</custreq>
          <revisitreason />
        </Tech>
      </Header>
    </NewDataSet>

     

     

    • Moved by Liliane Teng Tuesday, July 20, 2010 2:58 AM Please repost on appropriate forums for better support (From:Visual Basic General)
    Monday, July 19, 2010 2:19 PM

Answers

  • Hello tlu,
    Thanks for your post.
    This forum is for VB.NET questions only. Please repost on appropriate forum for better and quicker support. You could try to post on XML and XmlDataSource Control Forum. Thanks for your understanding.

    Best regards,
    Liliane


    Please mark the replies as answers if they help and unmark them if they provide no help. Thanks
    Tuesday, July 20, 2010 2:56 AM