Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ombrenelcielo

macrumors regular
Original poster
Hi all,
I am doing some research in my spare time to write a small script that checks and modifies logs written in XML..

Logs have this format:
PHP:
<value="sometexthere">
      <text>this is a place mark %%==here==%%</text>
</value>

What I am trying to achieve is to have a solution to replace a fixed place mark %%==here==%% with what stored in the element value.

I know that's very simple in perl and it's not a problem for me to script it in that language, but I wanted to ask you what could be a smart way to do it in javascript.

I guess I could use something like .replace(/%%==here==%%/, to capture the place holder, but then I would need to grab the value as element to put it in the replace function.
And being XML and not html I of course can't use getelementby... to grab my value=""

Any help appreciated 🙂
 
In the end I've opted to write a script in perl to parse the files, much easier.
I'll get my hands on this whenever I will have time 🙂
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.