klornpallier
Technical User
Hi,
PLease help as I've spent two days confused on this! I'm trying the read the xml file below node by node with the code also below this. All the childnodes values seem to be concatinated together on the output, for example:
DeliveryAddress : HO/A0221Wyatt HouseThe ButtsSanctuary GroupWorcesterWorcestershireWR1 3BH
But I want like the below for example:
AddressCode: HO/A0221
Address1 :Wyatt House
=====================
<?xml version="1.0" ?>
- <Orders>
- <Order>
<OrderNo>501238</OrderNo>
<Company>SFA</Company>
<OrderedBy>Meg Hearne</OrderedBy>
<DateOrdered>2010-08-04</DateOrdered>
<OrderDeliveryBy>mail</OrderDeliveryBy>
- <Supplier>
<SuppAcctCode>RARG01</SuppAcctCode>
<SuppAddrCode>RARG01</SuppAddrCode>
</Supplier>
- <OrderItems>
- <OrderItem>
- <RequisitionRef>
- <Doc>
<DocNo>502031</DocNo>
<DocLineNo>1</DocLineNo>
</Doc>
</RequisitionRef>
<Reference />
<DeliveryAddressCode>HO/A0221</DeliveryAddressCode>
- <DeliveryAddress>
<AddressCode>HO/A0221</AddressCode>
<Address1>Wyatt House</Address1>
<Address2>The Butts</Address2>
<Address3 />
<Company>Sanctuary Group</Company>
<TradingAs />
<Suburb>Worcester</Suburb>
<State>Worcestershire</State>
<PostCode>WR1 3BH</PostCode>
<Country />
</DeliveryAddress>
<DeliveryDate>2010-08-31</DeliveryDate>
<ItemCode>CAP101178</ItemCode>
<Description>Klorn Security minor Remodelling</Description>
<SuppItemCode />
<IsReceiptRequired>True</IsReceiptRequired>
<GoodsOrService>goods</GoodsOrService>
=====================
Dim xpathDoc As XPathDocument
Dim xmlNav As XPathNavigator
Dim ReqNo As XPathNodeIterator
xpathDoc = New XPathDocument("\\dev-ipos-01\support\XML Testing\Input\Purchase Orders\Pre Load\ORD-SFA-501238.xml")
xmlNav = xpathDoc.CreateNavigator()
ReqNo = xmlNav.Select("//Orders/Order/OrderItems/OrderItem/*")
While (ReqNo.MoveNext())
System.Console.WriteLine(ReqNo.Current.Name + " : " + ReqNo.Current.Value & " ")
End While
PLease help as I've spent two days confused on this! I'm trying the read the xml file below node by node with the code also below this. All the childnodes values seem to be concatinated together on the output, for example:
DeliveryAddress : HO/A0221Wyatt HouseThe ButtsSanctuary GroupWorcesterWorcestershireWR1 3BH
But I want like the below for example:
AddressCode: HO/A0221
Address1 :Wyatt House
=====================
<?xml version="1.0" ?>
- <Orders>
- <Order>
<OrderNo>501238</OrderNo>
<Company>SFA</Company>
<OrderedBy>Meg Hearne</OrderedBy>
<DateOrdered>2010-08-04</DateOrdered>
<OrderDeliveryBy>mail</OrderDeliveryBy>
- <Supplier>
<SuppAcctCode>RARG01</SuppAcctCode>
<SuppAddrCode>RARG01</SuppAddrCode>
</Supplier>
- <OrderItems>
- <OrderItem>
- <RequisitionRef>
- <Doc>
<DocNo>502031</DocNo>
<DocLineNo>1</DocLineNo>
</Doc>
</RequisitionRef>
<Reference />
<DeliveryAddressCode>HO/A0221</DeliveryAddressCode>
- <DeliveryAddress>
<AddressCode>HO/A0221</AddressCode>
<Address1>Wyatt House</Address1>
<Address2>The Butts</Address2>
<Address3 />
<Company>Sanctuary Group</Company>
<TradingAs />
<Suburb>Worcester</Suburb>
<State>Worcestershire</State>
<PostCode>WR1 3BH</PostCode>
<Country />
</DeliveryAddress>
<DeliveryDate>2010-08-31</DeliveryDate>
<ItemCode>CAP101178</ItemCode>
<Description>Klorn Security minor Remodelling</Description>
<SuppItemCode />
<IsReceiptRequired>True</IsReceiptRequired>
<GoodsOrService>goods</GoodsOrService>
=====================
Dim xpathDoc As XPathDocument
Dim xmlNav As XPathNavigator
Dim ReqNo As XPathNodeIterator
xpathDoc = New XPathDocument("\\dev-ipos-01\support\XML Testing\Input\Purchase Orders\Pre Load\ORD-SFA-501238.xml")
xmlNav = xpathDoc.CreateNavigator()
ReqNo = xmlNav.Select("//Orders/Order/OrderItems/OrderItem/*")
While (ReqNo.MoveNext())
System.Console.WriteLine(ReqNo.Current.Name + " : " + ReqNo.Current.Value & " ")
End While