Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
copy part of xml to other xml



deepthi28
New User

Nov 9, 2012, 4:58 AM


Views: 16914
copy part of xml to other xml

I have 2 xml files say one.xml and two.xml.

1.I need to update 5 tags in one.xml and copy 5 more tags from two.xml to one.xml.
2. Now, i need to update 5 tags in two.xml and copy 5 more tags from one.xml to two.xml.

I am using simple:XML in updating the tags and it is working fine.

Now, i have 2 problems.

1. The updated xml need to be written to the original one.xml by taking a backup of it.
2. copying the part of xml from two to one is not working.

Can anyone throw some help here.

Thanks


(This post was edited by deepthi28 on Nov 9, 2012, 4:59 AM)


Laurent_R
Veteran / Moderator

Nov 9, 2012, 2:08 PM


Views: 16908
Re: [deepthi28] copy part of xml to other xml

Hmm, I am not sure I understand everything.

Generally speaking (there are a few exceptions), you can't edit an existing file, you need to create a modified copy of it, and then replace the original file with the modified copy. (As for the exceptions, usually they still do a modified copy of the original file and do the necessary housecleaning behind the scenes.)

For problem 2, you will have to provide your code, there is no way we can help you with so little information.