Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

How to get the index of a node in XML

Avatar

Level 9

Hello All,

I want to loop through all the xml nodes that I embed in my form. I want to get the index of the node.For Ex : My xml looks like this

<CustomerInformation>
<CustomerID></CustomerID>
<CustomerName></CustomerName>
<CustomerType>PFRR</CustomerType>
<ContactName></ContactName>
<AddressLine3></AddressLine3>
<TelephoneNo></TelephoneNo>
<ShipToCode></ShipToCode>
</CustomerInformation>

There are approx 150 <customerinformation> node present in the xml. I want to delete those nodes excluding the nonly node that's used to fill the data in the form. Lets say I have used node 20 to fill the form. I would loop through all the nodes and simly delete those exclusing the node 20. So that while submitting only the node goes as xml.

Thanks.

0 Replies