| Author |
Groovy - XML script to modify a node's name and add an attribute.
|
Bill Lee
Greenhorn
Joined: Feb 02, 2007
Posts: 20
|
|
I am attempting to write a parser which would replace the <Line2 FirstName="Bill" MiddleName="" LastName="Thatcher"/> to
<AddressLine2 Title="Mr" FirstName="Bill" MiddleName="" LastName="Thatcher"/> . In other words, it would replace Line2 with AddressLine2 and add the attribute Title to it. The furthest I have gotten so far is removing Line2. Does anyone have any suggestions? Thanks.
<StreetAddress>
<Address>
<AddressLine1 />
<Line2 FirstName="Bill" MiddleName="" LastName="Thatcher"/>
</Address>
</StreetAddress>
|
 |
Freddy Wong
Ranch Hand
Joined: Sep 11, 2006
Posts: 959
|
|
|
Get the attributes of element AddressLine1 and create a new element Line1 with attributes of AddressLine1 and use replaceChild(newChild, oldChild) or something of that sort.
|
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
|
 |
 |
|
|
subject: Groovy - XML script to modify a node's name and add an attribute.
|
|
|