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"
I am using EvaluateXpath processor in Nifi. And my setting is attached in the image
I had even tried with /@ReferenceDocument. But not getting the node value. Please help here.
You missed the root element ns1:SalesOrderMessages
. This works for me:
Input
<?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>
</SalesOrder>
</ns1:SalesOrderMessages>
Xpath Expression
/*:SalesOrderMessages/SalesOrder/Header/ReferenceDocumentNumber
or
//ReferenceDocumentNumber
Output
SI-000000614