rename tag name by EOL [message #1729767] |
Mon, 18 April 2016 17:56 |
taghreed altamimi Messages: 184 Registered: October 2014 |
Senior Member |
|
|
Hello,
I have generated XML document but the I need to rename the tag names.
How can I do that using EOL .Is there any built in operation to do rename??
For example :
<activity1 name="OpaqueAction1" hostdemandmean="11.0" phase="1"/>
I need to rename activity1 to activity
Can you please help me.
Thanks ,
Taghreed.
[Updated on: Wed, 20 April 2016 17:11] Report message to a moderator
|
|
|
Re: rename tag name by EOL [message #1729991 is a reply to message #1729767] |
Wed, 20 April 2016 17:11 |
taghreed altamimi Messages: 184 Registered: October 2014 |
Senior Member |
|
|
Hello ,
I have generated XML document but the I need to rename the tag names.
How can I do that using EOL .Is there any built in operation to do rename??
For example :
<activity1 name="OpaqueAction1" hostdemandmean="11.0" phase="1"/>
I need to rename activity1 to activity
Can you please help me.
Thanks ,
Taghreed.
[Updated on: Wed, 20 April 2016 17:11] Report message to a moderator
|
|
|
|
|
Re: rename tag name by EOL [message #1730609 is a reply to message #1730245] |
Wed, 27 April 2016 06:09 |
taghreed altamimi Messages: 184 Registered: October 2014 |
Senior Member |
|
|
Hello,
How can I remove the old ones??
How can I create new children with attributes that are same to the old ones(removed ones).
for example how can I delete this
<activity1 name="OpaqueAction1" hostdemandmean="11.0" phase="1"/>
and then create this:
<activity name="OpaqueAction1" host_demand_mean="11.0" phase="1"/>
Can you please elaborate more .
Thanks,
Taghreed.
[Updated on: Wed, 27 April 2016 06:10] Report message to a moderator
|
|
|
Re: rename tag name by EOL [message #1730646 is a reply to message #1730609] |
Wed, 27 April 2016 10:45 |
|
The model elements in a plain XML model are instances of Element, so you can use removeChild or replaceChild as usual. Something like this should work:
// find the old one
var oldAc = parent.c_activity1.selectOne(c|c.name='OpaqueAction1');
// create the new one
var newAc = new t_activity;
newAc.a_name = oldAc.a_name;
newAc.a_host_demand_mean = oldAc.a_host_demand_mean;
// same with other attributes ...
// replace within the parent
parent.replaceChild(oldAc, newAc);
|
|
|
|
Powered by
FUDForum. Page generated in 0.05842 seconds