Here is a sample of the XML
I need to get the <Order Header> Nodes, then loop through the <Order Detal> <Line> Nodes

Using xml Reader "Using reader As XmlReader = XmlReader.Create(New StringReader(sFileContects))", i get all the header information, but cant properly parse the Line Iformation

Using LINQ "Dim xd As XDocument = XDocument.Parse(sFileContects)" I get nothing

<ResponseBatch ConsumerKey="[API-Publ]" Language="en" DateTime="2014091213" SerialID="">
<Response RequestID="GetOrder" Company="01" SerialID="">
<Orders>
<Order>
<OrderHeader>
<CompanyNumber>01</CompanyNumber>
<CustomerNumber>3593</CustomerNumber>
<OrderNumber>LK3581</OrderNumber>
<OrderSuffix>0</OrderSuffix>
<OrderType>O</OrderType>
<OrderStatus>2</OrderStatus>
<CustomerName>Bob</CustomerName>
<CustomerAddress1>1234 1st St</CustomerAddress1>
<CustomerAddress2/>
<BillToCity>AnyTown</BillToCity>
<BillToState>WA</BillToState>
<BillToZipCode>98000</BillToZipCode>
<BillToContact>FAX</BillToContact>
<ShipToNumber>1803</ShipToNumber>
<ShipToName>Bob One</ShipToName>
<ShipToAddress1>321 2nd St.</ShipToAddress1>
<ShipToAddress2/>
<ShipToCity>Bob Town</ShipToCity>
<ShipToState>WA</ShipToState>
<ShipToZipCode>98001</ShipToZipCode>
<Contact/>
<EntryDate>09/11/2014</EntryDate>
<RequestedShipDate>09/11/2014</RequestedShipDate>
<CustomerPurchaseOrderNumber>18033581</CustomerPurchaseOrderNumber>
<ItemSalesAmount>366.68</ItemSalesAmount>
<DiscountAmountTrading>.00</DiscountAmountTrading>
<SalesTaxAmount>31.53</SalesTaxAmount>
<InvoiceAmount>398.21</InvoiceAmount>
<TotalOrderValue>398.21</TotalOrderValue>
<TotalSpecialCharges>0</TotalSpecialCharges>
<CarrierCode>SERVICE</CarrierCode>
<WarehouseID>03</WarehouseID>
<InvoiceNumber/>
<OrderStatus>COM</OrderStatus>
</OrderHeader>
<OrderDetail>
<Line>
<LineNumber>1</LineNumber>
<ItemType>C</ItemType>
<CommentType>I</CommentType>
<ItemDescription1>CODE: 086664058</ItemDescription1>
</Line>
<Line>
<LineNumber>2</LineNumber>
<ItemType>C</ItemType>
<CommentType>I</CommentType>
<ItemDescription1>NEED ALL Work Done</ItemDescription1>
</Line>
<Line>
<LineNumber>3</LineNumber>
<ItemType>C</ItemType>
<CommentType>I</CommentType>
</Line>
<Line>
<CustomerNumber>3593</CustomerNumber>
<LineNumber>4</LineNumber>
<ItemNumber>CT70122</ItemNumber>
<ItemType>I</ItemType>
<ItemDescription1>ELEMENT</ItemDescription1>
<ItemDescription2>3/4" PLATE</ItemDescription2>
<QuantityOrdered>8</QuantityOrdered>
<QuantityShipped>0</QuantityShipped>
<QuantityBackordered>0</QuantityBackordered>
<UnitOfMeasure>EA</UnitOfMeasure>
<PricingUM>EA</PricingUM>
<ActualSellPrice>12.24</ActualSellPrice>
<TotalLineAmount>97.92</TotalLineAmount>
</Line>
<Line>
<CustomerNumber>3593</CustomerNumber>
<LineNumber>5</LineNumber>
<ItemNumber>FEE</ItemNumber>
<ItemType>I</ItemType>
<ItemDescription1>CHARGE</ItemDescription1>
<ItemDescription2>ENVIRONMENTAL</ItemDescription2>
<QuantityOrdered>8</QuantityOrdered>
<QuantityShipped>0</QuantityShipped>
<QuantityBackordered>0</QuantityBackordered>
<UnitOfMeasure>EA</UnitOfMeasure>
<PricingUM>EA</PricingUM>
<ActualSellPrice>4.18</ActualSellPrice>
<TotalLineAmount>33.44</TotalLineAmount>
</Line>
<Line>
<CustomerNumber>3593</CustomerNumber>
<LineNumber>6</LineNumber>
<ItemNumber>LABOR-SE</ItemNumber>
<ItemType>I</ItemType>
<ItemDescription1>LABOR, (On-Site/Shop Service)</ItemDescription1>
<ItemDescription2>BRANCH ONE</ItemDescription2>
<QuantityOrdered>2.00</QuantityOrdered>
<QuantityShipped>0</QuantityShipped>
<QuantityBackordered>0</QuantityBackordered>
<UnitOfMeasure>EA</UnitOfMeasure>
<PricingUM>EA</PricingUM>
<ActualSellPrice>70.00</ActualSellPrice>
<TotalLineAmount>140</TotalLineAmount>
</Line>
</OrderDetail>
</Order>
</Orders>
</Response>
</ResponseBatch>

Sorry, cant figure out how to edit my first post.

Making progress, but I am gettting all the inner nodes return as one line with this code.

        Dim xd As XDocument = XDocument.Parse(sFileContects)
        Debug.Print(GetNumElements(xd))
        For Each element As XElement In xd.Descendants("Line")
            Debug.Print(element.Value)
        Next

Got It!

        Dim xd As XDocument = XDocument.Parse(sFileContects)
        Debug.Print(GetNumElements(xd))
        For Each element As XElement In xd.Descendants("Line")
            Select Case element.Descendants("ItemType").Value
                Case "C"
                    Debug.Print("C" & element.Descendants("ItemDescription1").Value)
                Case "I"
                    Debug.Print("I" & element.Descendants("ItemNumber").Value)
                    Debug.Print("I" & element.Descendants("ItemDescription1").Value)
                    Debug.Print("I" & element.Descendants("ItemDescription2").Value)
                    Debug.Print("I" & element.Descendants("ActualSellPrice").Value)
                Case Else

            End Select
        Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.