HiHo,

i try to parse the result of a amazon xml response via the webservice. if i call this service i got an xml Datafile like this:

<Details url="http://www.amazon.com/exec/obidos/redirect?tag=webser +vices-20%26creative=666%26camp=2025%26link_code=xm2%26path=ASIN/05960 +00480"> <Asin>0596000480</Asin> <Authors> <Author>David Flanagan</Author> </Authors> <Lists> <ListId>IEF1DNVKZO8B</ListId> <ListId>1R36BE3AUD988</ListId> <ListId>3S02XL0KTQDW0</ListId> </Lists> <BrowseList> <BrowseNode> <BrowseName>Computer Books: Languages</BrowseName> </BrowseNode> <BrowseNode> <BrowseName>Computer Programming Languages</BrowseName> </BrowseNode> </BrowseList> <Reviews> <AvgCustomerRating>4.31</AvgCustomerRating> <TotalCustomerReviews>178</TotalCustomerReviews> <CustomerReview> <Rating>5</Rating> <Summary>Excellent reference, not a "how to" book</Summary +> <Comment>... comment ...</Comment> </CustomerReview> <CustomerReview> <Rating>5</Rating> <Summary>Superb Reference</Summary> <Comment>... comment ...</Comment> </CustomerReview> </Reviews> </Details>

But now i will print out the informtion into a template. Can anyone give me a short eg. how to do this. i tried to do this with xml::simple like that:

$xmltree->{Node}

But for the deeper nested Nodes i've no idee how to catch it? And also the Attributes like "url" in the Details-Node.

Thx for any help ;o)

Rufnex


In reply to How to parse this XML? by Rufnex

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.