|Keep It Simple, Stupid|
Transliteration inside an XML fileby nikop (Initiate)
|on Jun 19, 2014 at 10:14 UTC||Need Help??|
nikop has asked for the wisdom of the Perl Monks concerning the following question:
I apologise if my question is very complicated or somehow unclear, I'm very new in this! I've looked into this problem for a while, but now I got in my work to a point where getting this run correctly would save me lots of time. I'm a linguist, and I encounter really often text files which are in the language I study, but in a wrong transcription or orthography. I understood that Perl can help me with converting them to another character set, and after looking models and hints from several transliteration scripts I found online I ended up to this, and it works very well:
It does its job well and converts text like "menö šuöny niko" to "менӧ шуӧны нико".
However, I often have the old transcription inside an XML file. They are done in program called ELAN. It has basically a structure like this:
So I would like to run the transliteration script to the text: "menö šuöny niko" inside the structure:
However, this would need to happen only in the nodes inside the structure:
So the final result would be like:
It would need to do the change only here as there are other tiers with different data that should remain as it is.
Also if you think I should specifically read something more about this I'm ready to do that. I honestly want to learn Perl. I didn't know if it is ok to post really long pieces of code, so I just took these small pieces that illustrate what I'm doing. I guess I would need to select the right XML node in XPath or something similar, but I have no idea where to put this into the perl script! I've been learning about Perl and XML during the last months, but I'm still taking very early steps.
Thank you for all the help!