Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello Sir,
I have a XML file as follows:
##################################################################################
<?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="COOKING"> <title>Everyday Italian</title> <lang>en</lang> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="CHILDREN"> <title>Harry Potter</title> <lang>en</lang> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="WEB"> <title>XQuery Kick Start</title> <lang>fr</lang> <author>James McGovern</author> <author>Per Bothner</author> <author>Kurt Cagle</author> <author>James Linn</author> <author>Vaidyanathan Nagarajan</author> <year>2003</year> <price>49.99</price> </book> <book category="WEB"> <title>Learning XML</title> <lang>br</lang> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price> </book> </bookstore>
##################################################################
I am writing a perl script using XML::Twig. What i want is as follows:
[root@localhost MyPrgs]# MyScript.pl COOKING
should fetch the corresponding TITLE and now I have another simple text file which is as follows:
#################################################################################
TITLE COUNTRY HITS PUBLICATIO +N Everyday Italian USA 101 Stallion vryday Italian SA 11 Stallion1 Everyday Italian1 USA2 01 Stallion2 Everyday Italian2 USA3 121 Stallion3 Everyday Italian3 USA4 151 Stallion4
#################################################################################
Now it will find for "Everyday Italian" (the TITLE) in Simple.txt and output the following to STDOUT:
####################################################################################################
TITLE COUNTRY AUTHOR + PUBLICATION PRICE Everyday Italian USA Giada De Laurentiis Stallion +30.00
####################################################################################################
Will XML::Twig be a correct approach, is this possible by XML::Simple or xmlgrep?
I am a beginner, a novice...could you help me out with this sir. Could you also give me a direction to move on.
--
Best Regards,
Cherry
20070815 Janitored by Corion: Removed excessive formatting, added code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Twig / Simple / xmlgrep --help
by Jenda (Abbot) on Aug 15, 2007 at 22:15 UTC | |
by Anonymous Monk on Aug 16, 2007 at 06:45 UTC | |
by Jenda (Abbot) on Aug 16, 2007 at 08:27 UTC | |
by Anonymous Monk on Aug 16, 2007 at 09:13 UTC | |
by Jenda (Abbot) on Aug 16, 2007 at 09:59 UTC | |
| |
|
Re: Twig / Simple / xmlgrep --help
by Anonymous Monk on Aug 15, 2007 at 03:29 UTC |