Support Questions

Find answers, ask questions, and share your expertise

NIFI Reading value in XML node

avatar
Contributor

I have the following xml:

<?xml version="1.0" encoding="UTF-8"?><ns1:SalesOrderMessages mlns:ns1="http://corpintra.net/pi/CBFC_GLOBAL_SAP_APPL/SalesOrder" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <SalesOrder>
            <MessageProcessingInformation>
               <SendingSystemID>SMS_0175</SendingSystemID>
            </MessageProcessingInformation>
            <Header>
               <SalesDocumentType>YPO0</SalesDocumentType>
               <SalesOrganization>7002</SalesOrganization>
               <DistributionChannel>00</DistributionChannel>
               <RequestedDeliveryDate>2023-06-15</RequestedDeliveryDate>
               <CustomerPurchaseOrderDate>2023-06-15</CustomerPurchaseOrderDate>
               <Incoterms1>EXW</Incoterms1>
               <Incoterms2>Ex Works</Incoterms2>
               <PaymentTerms>E007</PaymentTerms>
               <CustomerPurchaseOrderNumber>990831 </CustomerPurchaseOrderNumber>
               <ReferenceDocumentNumber>SI-000000614</ReferenceDocumentNumber>
               <ServicesRenderedDate>2023-06-15</ServicesRenderedDate>
               <LogisticData>
                  <SourceReferenceDocumentNumber>SI-000000614</SourceReferenceDocumentNumber>
                  <SourceSalesOrderNumber>SO-000050562</SourceSalesOrderNumber>
               </LogisticData>
            </Header>
            <Items>
               <ItemNumber>10</ItemNumber>
                   ............

 

I need to read the node value "ReferenceDocumentNumber", which is "SI-000000614"


EvaluateXpath.PNG
But this is not helping. I tried with addng "/@ReferenceDocumentNumber". Please guide me here

 

1 REPLY 1

avatar
Super Guru

Hi,

The path you specified seems to be correct according to the XML you provided. Since you did not provide the full XML I was only able to test it on the following:

 

<?xml version="1.0" encoding="UTF-8"?>
<SalesOrder>
	<MessageProcessingInformation>
		<SendingSystemID>SMS_0175</SendingSystemID>
	</MessageProcessingInformation>
	<Header>
		<SalesDocumentType>YPO0</SalesDocumentType>
		<SalesOrganization>7002</SalesOrganization>
		<DistributionChannel>00</DistributionChannel>
		<RequestedDeliveryDate>2023-06-15</RequestedDeliveryDate>
		<CustomerPurchaseOrderDate>2023-06-15</CustomerPurchaseOrderDate>
		<Incoterms1>EXW</Incoterms1>
		<Incoterms2>Ex Works</Incoterms2>
		<PaymentTerms>E007</PaymentTerms>
		<CustomerPurchaseOrderNumber>990831 </CustomerPurchaseOrderNumber>
		<ReferenceDocumentNumber>SI-000000614</ReferenceDocumentNumber>
		<ServicesRenderedDate>2023-06-15</ServicesRenderedDate>
		<LogisticData>
			<SourceReferenceDocumentNumber>SI-000000614</SourceReferenceDocumentNumber>
			<SourceSalesOrderNumber>SO-000050562</SourceSalesOrderNumber>
		</LogisticData>
	</Header>
</SalesOrder>

and I was able to get the ReferenceDocumentNumber using the Path:

/SalesOrder/Header/ReferenceDocumentNumber

Notice I had to remove the following line because I was getting Parsing Error:

<ns1:SalesOrderMessages mlns:ns1="http://corpintra.net/pi/CBFC_GLOBAL_SAP_APPL/SalesOrder" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

What are you seeing exactly? Are you seeing an error or the value is not populated in the FileName  attribute ? Can you please provide more info on that?

Thanks