I have an XML file and I want to replace every uppercase word with a code (example -x! Where x is the number of uppercase words).
This is my xml:
<a att="HELLO">
<b int="Ten">
<c time="0">Lorem IPSUM dolor sit AMET,</c>
<c time="10">consectetuer ADIPISCING elit.</c>
</b>
<b int="Twenty">
<c time="20">Aenean COMMODO ligula EGET dolor.</c>
</b>
<b int="Forty">
<c time="25">Aenean massa. </c>
<c time="30">CUM sociis natoque penatibus et MAGNIS dis parturient montes,</c>
<c time="40">nascetur ridiculus mus.</c>
</b>
Etc...
</a>
Now, what I want is pass the string to a function and return a xml like this:
<a att="HELLO">
<b int="Ten">
<c time="0">Lorem -0! dolor sit -1!,</c>
<c time="10">consectetuer -2! elit.</c>
</b>
<b int="Twenty">
<c time="20">Aenean -3! ligula -4! dolor.</c>
</b>
<b int="Forty">
<c time="25">Aenean massa. </c>
<c time="30">-5! sociis natoque penatibus et -6! dis parturient montes,</c>
<c time="40">nascetur ridiculus mus.</c>
</b>
Etc...
</a>
I have to store all the uppercase words in an array because at the end I want another function to replace every code (-x!) with is respective word.
I'm not at home right now so I can't show the code that I tried (I will update the question with code as soon as possible)