Hello Experts
I am looking at reading the xml nodes with multiple occurrence and copying it as a string along with the xml tags. In the below example I am looking at copying the attachments xml tags as a string
Input
<?xml version="1.0" encoding="utf-8"?>
<newHire>
<applicationID>20025</applicationID>
<startDate>2022-02-15T09:00:00</startDate>
<employmentType>1789</employmentType>
<position>41000332</position>
<payGrade>S17</payGrade>
<company>6910</company>
<contractType>1651</contractType>
<firstName>Micheal</firstName>
<lastName>Essien</lastName>
<preferredName>Micheal</preferredName>
<employeeClass>1781</employeeClass>
<attachments>
<name>DriversLicence</name>
<fileName>DriversLicence.jpg</fileName>
<fileContent>Base64Format</fileContent>
<documentType>DL</documentType>
<notes>DriversLicence</notes>
</attachments>
<attachments>
<name>Passport</name>
<fileName>Passport.jpg</fileName>
<fileContent>Base64Format</fileContent>
<documentType>Passport</documentType>
<notes>Passport</notes>
</attachments>
</newHire>
Output
<attachments><name>DriversLicence</name><fileName>DriversLicence.jpg</fileName><fileContent>Base64Format</fileContent><documentType>DL</documentType><notes>DriversLicence</notes></attachments><attachments><name>Passport</name><fileName>Passport.jpg</fileName><fileContent>Base64Format</fileContent><documentType>Passport</documentType><notes>Passport</notes></attachments>
I am new to groovy and I was exploring XmlSlurper and I have noticed GpathResult will fetch the value but not the xml tags
Can you please let me know how I can meet this requirement.
Appreciate your support
Regards
Advit