cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Extract attributes from XML

rakeshroshanjha
Newcomer
0 Likes
1,030

I want to extract 2-attributes from XML. The names of attribute for extraction from this xml is -

ERPNumber, 

ProcurementUnit/UniqueName

UniqueName

 

My XML structures look like this -

<SimplifiedRequest>
<CancelExportRequest>
<OrdHeader_Item>
<item>
<ERPNumber>Y465643</ERPNumber>
<ProcurementUnit>
<UniqueName>6604</UniqueName>
</ProcurementUnit>
<UniqueName>EPT10053-V3</UniqueName>
<VersionNumber>3</VersionNumber>
<custom>
<CustomBoolean name="SuppressOrder">false</CustomBoolean>
<CustomString name="Test"/>
<CustomString name="SupplierID">AEQ600:0000399413</CustomString>
</custom>
</item>
</OrdHeader_Item>
</CancelExportRequest>
</SimplifiedRequest>

Can you help me here?

 

Accepted Solutions (1)

Accepted Solutions (1)

nageshrao
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Rakesh, 

There are multiple ways to achieve your requirement to extract the values as requested. 

The simplest among them would be to use a Content Modifier and extract the attribute values to be stored in properties. This can be achieved using creating properties with relevant XPath expressions. We can create three properties by configuring XPaths as below for the Content Modifier

  • For ERPNumber:

    • Name: ERPNumber
    • Type: XPath
    • Value: Use the XPath expression /SimplifiedRequest/CancelExportRequest/OrdHeader_Item/item/ERPNumber
  • For ProcurementUnit_UniqueName:

    • Name: ProcurementUnit_UniqueName
    • Type: XPath
    • Value: Use the XPath expression /SimplifiedRequest/CancelExportRequest/OrdHeader_Item/item/ProcurementUnit/UniqueName
  • For UniqueName (directly under item):

    • Name: UniqueName
    • Type: XPath
    • Value: Use the XPath expression /SimplifiedRequest/CancelExportRequest/OrdHeader_Item/item/UniqueName

 

 

nageshrao_0-1725428852955.png

Alternatively, you can use groovy script or XSLT transformation if you have some other extra steps where you want to use the extracted values instead of storing in properties for further usage.




Answers (1)

Answers (1)

anoukvandenengel
Participant
0 Likes

Hi, try:

/SimplifiedRequest/CancelExportRequest/OrdHeader_Item/item/ERPNumber
/SimplifiedRequest/CancelExportRequest/OrdHeader_Item/item/ProcurementUnit/UniqueName
/SimplifiedRequest/CancelExportRequest/OrdHeader_Item/item/UniqueName

anoukvandenengel_0-1725427315300.png

anoukvandenengel_1-1725427358174.png