Example of an XPath

For an API call returning content of type application/xml, this sample could be part of the reply:

<?xml version="1.0"?>
<SalesOrder>
   <SalesOrderHeader>
      <CustomerParty>
         <PartyIDs>
	      <ID
		 accountingEntity="customer180"
		 lid="lid://infor.app.nldv1180">RGT000043</ID>
	   </PartyIDs>
	   <Name>Purchasing Business Partner</Name>
	   <Location type="Office">
	      <Address>
		   <AttentionOfName>Millers &amp; Co.</AttentionOfName>
		   <AddressLine sequence="1">De Dam 1</AddressLine>
		   <AddressLine sequence="2"/>
		   <CityName>Amsterdam</CityName>
		   <CountrySubDivisionCode>NH</CountrySubDivisionCode>
		   <CountryCode>NL</CountryCode>
		   <PostalCode>1001 BA</PostalCode>
		</Address>
	   </Location>
	   <Location type="Billing">
	      <ID 
               accountingEntity="customer180"
		   lid="lid://infor.app.nldv1180">D_RGSLS1</ID>
		<Name>Regional Office</Name>
	   </Location>
	</CustomerParty>
   </SalesOrderHeader>	
</SalesOrder>

To retrieve the city name where the customer’s office is located, you can use an XPath expression with a filter on the Location attribute @type:

SalesOrder/SalesOrderHeader/CustomerParty/Location[@type=”Office”]/Address/CityName

The resulting value in this case is "Amsterdam".

Note: The XPaths are run in the default namespace of the XML document. If there are explicit namespace prefixes used in the tag names, you can use standard XPath syntax to find the right value.