How to modify a nested XML element using Java
Posted: Tue Jul 03, 2018 2:33 pm
I have an XML file stored in src/test/resources.
I am trying to do the following:
1. Retrieve the XML Body
2. Modify a nested element within the body
3. Convert the XML body to a string
Below is a sample XML:
So I want to change Client.Location.Address.Line1 within my java method, & then convert that entire XML to a string. But, I don't want to overwrite the original XML.
Can this be done?
I am trying to do the following:
1. Retrieve the XML Body
2. Modify a nested element within the body
3. Convert the XML body to a string
Below is a sample XML:
Code: Select all
<Client>
<Name>
</Name>
<Location>
<Address>
<Line1>Test Address<Line1>
</Address>
</Location>
</Client>
Can this be done?