P
P
Hi
I have a scenario in which we are adding a new tag to the existing
structure of the XML files, some of the new files created might have
the newly added tag with value / just an empty tag, all I need is to
add the new tag if it is not present with the value available in
another tag, or if it is empty have to give the value from the other
tag to this.
For Example:
Old XML file:
<employee>
<personal_details>
<fname>Annbu</fname>
<lname>P</lname>
<empid>7655</empid>
</personal_details>
......
</employee>
New XML file:
<employee>
<personal_details>
<fname>Annbu</fname>
<lname>P</lname>
<nickname>Annbu</nickname>
<empid>7655</empid>
</personal_details>
......
</employee>
in the new file we have added a new field/tag called <nickname> - for
the existing XML files it has to take the value present in the <fname>
tag, (if the tag is empty we need to add the value, else have to add
the new tag with the value).
Kindly let me know, how to do it with perl, I am new to perl.
thank you.
Regards,
Annbu P
I have a scenario in which we are adding a new tag to the existing
structure of the XML files, some of the new files created might have
the newly added tag with value / just an empty tag, all I need is to
add the new tag if it is not present with the value available in
another tag, or if it is empty have to give the value from the other
tag to this.
For Example:
Old XML file:
<employee>
<personal_details>
<fname>Annbu</fname>
<lname>P</lname>
<empid>7655</empid>
</personal_details>
......
</employee>
New XML file:
<employee>
<personal_details>
<fname>Annbu</fname>
<lname>P</lname>
<nickname>Annbu</nickname>
<empid>7655</empid>
</personal_details>
......
</employee>
in the new file we have added a new field/tag called <nickname> - for
the existing XML files it has to take the value present in the <fname>
tag, (if the tag is empty we need to add the value, else have to add
the new tag with the value).
Kindly let me know, how to do it with perl, I am new to perl.
thank you.
Regards,
Annbu P