EDN Admin
Well-known member
Hi to all,
I am looking for the best solution for the following problem.
I need to loop through an existing XML document adding elements in the appropriate places. For example adding a <NEW_ELEMENT> element to every vehicle element in the file.
Can anybody give me any ideas on how to accomplish this please?
Thanking you all for taking the time to read this.
Gary
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; drivers<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driverid<span style="color:Blue; >red5<span style="color:Blue; </<span style="color:#A31515; driverid<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; fullname<span style="color:Blue; >luke skywalker<span style="color:Blue; </<span style="color:#A31515; fullname<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; birthdate<span style="color:Blue; >a long time ago<span style="color:Blue; </<span style="color:#A31515; birthdate<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; placeofbirth<span style="color:Blue; >a galaxy far far away<span style="color:Blue; </<span style="color:#A31515; placeofbirth<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >landspeeder<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; type<span style="color:Blue; >ground<span style="color:Blue; </<span style="color:#A31515; type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >DATA<span style="color:Blue; </<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >x-wing<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; type<span style="color:Blue; >air<span style="color:Blue; </<span style="color:#A31515; type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >DATA<span style="color:Blue; </<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driverid<span style="color:Blue; >eccho7<span style="color:Blue; </<span style="color:#A31515; driverid<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; fullname<span style="color:Blue; >Han Solo<span style="color:Blue; </<span style="color:#A31515; fullname<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; birthdate<span style="color:Blue; >a long time ago<span style="color:Blue; </<span style="color:#A31515; birthdate<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; placeofbirth<span style="color:Blue; >correlia<span style="color:Blue; </<span style="color:#A31515; placeofbirth<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >millenium falcon<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; type<span style="color:Blue; >air<span style="color:Blue; </<span style="color:#A31515; type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >DATA<span style="color:Blue; </<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; drivers<span style="color:Blue; >
[/code]
<br/>
View the full article
I am looking for the best solution for the following problem.
I need to loop through an existing XML document adding elements in the appropriate places. For example adding a <NEW_ELEMENT> element to every vehicle element in the file.
Can anybody give me any ideas on how to accomplish this please?
Thanking you all for taking the time to read this.
Gary
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; drivers<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driverid<span style="color:Blue; >red5<span style="color:Blue; </<span style="color:#A31515; driverid<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; fullname<span style="color:Blue; >luke skywalker<span style="color:Blue; </<span style="color:#A31515; fullname<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; birthdate<span style="color:Blue; >a long time ago<span style="color:Blue; </<span style="color:#A31515; birthdate<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; placeofbirth<span style="color:Blue; >a galaxy far far away<span style="color:Blue; </<span style="color:#A31515; placeofbirth<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >landspeeder<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; type<span style="color:Blue; >ground<span style="color:Blue; </<span style="color:#A31515; type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >DATA<span style="color:Blue; </<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >x-wing<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; type<span style="color:Blue; >air<span style="color:Blue; </<span style="color:#A31515; type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >DATA<span style="color:Blue; </<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; driverid<span style="color:Blue; >eccho7<span style="color:Blue; </<span style="color:#A31515; driverid<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; fullname<span style="color:Blue; >Han Solo<span style="color:Blue; </<span style="color:#A31515; fullname<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; birthdate<span style="color:Blue; >a long time ago<span style="color:Blue; </<span style="color:#A31515; birthdate<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; placeofbirth<span style="color:Blue; >correlia<span style="color:Blue; </<span style="color:#A31515; placeofbirth<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >millenium falcon<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; type<span style="color:Blue; >air<span style="color:Blue; </<span style="color:#A31515; type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >DATA<span style="color:Blue; </<span style="color:#A31515; NEW_ELEMENT<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; vehicle<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; driver<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; drivers<span style="color:Blue; >
[/code]
<br/>
View the full article