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


In reply to Twig / Simple / xmlgrep --help by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.