corfuitl has asked for the wisdom of the Perl Monks concerning the following question:
Hi PerlMonks
I have the following bilingual file and would like to extract the source and target nodes preserving its xml elements they might have as well as the line breaks. Could you please help me on that? I have no experience in xml parsing with Perl.
Here is a sample of my file:
<trans-unit id="1" maxbytes="14"> <source xml:lang="en-US">Hello <x id=1/> world! How are you?</source> <target xml:lang="ja-JP">Ciao<x id=1/> mondo! Come stai?</target> </trans-unit>
The expected result should be:
Hello <x id=1/> world! <lb/> How are you? || Ciao<x id=1/> mondo! <lb/> Come stai?
Thank you for your time!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing XML file and keeping the formatting tags
by choroba (Cardinal) on Mar 22, 2018 at 16:49 UTC | |
by corfuitl (Sexton) on Mar 22, 2018 at 18:56 UTC | |
by stevieb (Canon) on Mar 22, 2018 at 21:23 UTC | |
|
Re: Parsing XML file and keeping the formatting tags
by Your Mother (Archbishop) on Mar 22, 2018 at 15:55 UTC | |
|
Re: Parsing XML file and keeping the formatting tags
by Lotus1 (Vicar) on Mar 22, 2018 at 15:21 UTC | |
by corfuitl (Sexton) on Mar 22, 2018 at 15:26 UTC |