Skip to Content
Oct 20, 2021 at 10:32 AM

How to delete child node from a XML SAP CPI without loosing the child content

481 Views Last edit Oct 20, 2021 at 10:57 AM 2 rev

Hi Experts,

I am working on a scenario where the 3rd party sending numeric fields instead of field names. we can't create XSD for numeric due to xml limitations so I created a property for each field from the content modifier and calling the same in body. But for response case we may or may not receive the numeric tag based on some document number issue.

here is my the input I'm receiving:

<?xml version='1.0' encoding='UTF-8'?><root><data/><metadata><createdRecordIds/><lineErrors><1>The field with ID '6' has an invalid choice.</1></lineErrors><totalNumberOfRecordsProcessed>1</totalNumberOfRecordsProcessed><unchangedRecordIds/><updatedRecordIds/></metadata></root>

Typically in xml here is the input <lineErrors> <1> the field with id 6 has invalid choice </1> </lineErrors>. but I need to remove the child tag <1></1> and should retrieve content inside that tag.

Expected output : <lineErrors>the field with id 6 has invalid choice</lineErrors>.