ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I need to write a script that will do the following:
The script will be called by an application while, at the same time, the application will create an xml file. After that, I want to process the xml file and derive only the text included by specific tags. Then, I want that text to be passed to another application that will make some automatic substitutions (this program can accept standard input or text files). After that, I want the changed text to return to its original position in the original xml.
This seems quite complex to me, but I would like some help with the logic and the steps I must follow. As I see it, I would have to assign the text I want to a global variable, which will then be passed to the 2nd application that will do the substitutions. Should I use a text editor (sth like sed maybe) to parse the xml and find the text? Are there any command line xml editors that will make the procedure easier?
I am half way to accomplish it -- more help please
Hello,
You guys were absolutely right about using an xml command-line parser. After I gave up with grep, I found a fantastic program, xmlstarlet, that simplifies incredibly the task of extracting the text I want.
Now, I have found the way to put the modified text back to the xml file, but I need some advice about accessing the other application that will process it. The other application runs on another machine, my server, so I have to find a way to pass the text there and have it back modified to my desktop pc. One more challenge is that the remote program loads huge amount of data in memory when it is called, so I need that data to stay in memory otherwise the processing of the text is very time consuming. I was advised to use netpipes, hose and faucet, to establish a client-server communication. However, I can't find much documentation about this.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.