<?xml version="1.0" encoding="UTF-8"?>
<Orders xmlns="www.test-inc.com">
<Order>
<Header>
<Address>
<AddressTypeCode>ST</AddressTypeCode>
<LocationCodeQualifier>51</LocationCodeQualifier>
<AddressName>Pepsi Distribution Center</AddressName>
<AddressAlternateName>ABC 123</AddressAlternateName>
<Address1>Safeway 7th Street</Address1>
<Address2>Suite 1</Address2>
<City>Detroit</City>
<State>MI</State>
<PostalCode>12345</PostalCode>
<Country>USA</Country>
</Address>
<Address>
<AddressTypeCode>BT</AddressTypeCode>
<LocationCodeQualifier>51</LocationCodeQualifier>
<AddressLocationNumber>15513432</AddressLocationNumber>
<AddressName>Main Headquarters</AddressName>
<AddressAlternateName>Attn: John</AddressAlternateName>
<Address1>147 Dupont Ave</Address1>
<Address2>Dock 123</Address2>
<City>Orlando</City>
<State>FL</State>
<PostalCode>12345</PostalCode>
<Country>USA</Country>
<Contact>
<ContactTypeCode>BD</ContactTypeCode>
<ContactName>Jane Doe</ContactName>
<PrimaryPhone>111-222-3333</PrimaryPhone>
<PrimaryFax>111-222-3333</PrimaryFax>
<PrimaryEmail>buyer@TEST.com</PrimaryEmail>
</Contact>
</Address>
</Header>
// Ship to Address
var addresses = xdoc.XPathSelectElements("//testinc:Address", nsmgr);//Get all the address childs : 2 in this case
List<string> listofAddresses = new List<string>();//List to store the addresses
foreach (XElement address in addresses)//For each line item
{
//something here?
}
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.