Hi Monks, I have an XML like below. I need to fetch only values Agreement ID, Cycle Code and Subscriber ID List values. However agreement id and cycle code contains always single values but subscriber id list can contain multiple values as in the snippet below. Kindly please help.
<PerformanceIndicator type="VEL Allowance pooling occurrence recurring + rolling restricted period sensitive with bundling" version="00000000 +0"> <Attribute name="Item ID" basicType="Numeric"><Value value="23409056"/ +></Attribute> <Attribute name="Agreement ID" basicType="Numeric"><Value value="15827 +134"/></Attribute> <Attribute name="Cycle code" basicType="Numeric"><Value value="1301"/> +</Attribute> <Attribute name="Cycle year" basicType="Numeric"><Value value="2015"/> +</Attribute> <Attribute name="Cycle month" basicType="Numeric"><Value value="2"/></ +Attribute> <Attribute name="Customer ID" basicType="Numeric"><Value value="164922 +51"/></Attribute> <Attribute name="PI type ID" basicType="Numeric"><Value value="9436004 +9"/></Attribute> <Attribute name="Offer instance" basicType="Numeric"><Value value="140 +546178"/></Attribute> <Attribute name="Rerate type" basicType="String"><Value value="R"/></A +ttribute> <Attribute name="Last event date" basicType="DateTime"><Value value="2 +015-02-25 19:34:41"/></Attribute> <Attribute name="Offer ID" basicType="Numeric"><Value value="23408986" +/></Attribute> <Attribute name="Expiration date" basicType="DateTime"><Value value="2 +015-02-28 23:59:59"/></Attribute> <Attribute name="PI status" basicType="Numeric"><Value value="4"/></At +tribute> <Attribute name="Billing arrangement" basicType="Numeric"><Value value +="0"/></Attribute> <Attribute name="Pay channel" basicType="Numeric"><Value value="0"/></ +Attribute> <Attribute name="Dummy string" basicType="String"><Value value="0"/></ +Attribute> <Attribute name="Dummy numeric" basicType="Numeric"><Value value="0"/> +</Attribute> <Attribute name="Dummy date" basicType="DateTime"><Value value="2020-1 +2-31 19:50:00"/></Attribute> <Attribute name="Dummy boolean" basicType="Boolean"><Value value="Yes" +/></Attribute> <Attribute name="Proration factor" basicType="Numeric"><Value value="1 +.0000"/></Attribute> <Attribute name="Quota per period" basicType="Numeric"><Value value="7 +500.00"><DimensionKey dimensionName="Period" index="0" value="0" nam +e=""/></Value></Attribute> <Attribute name="Rolled from previous cycle per period" basicType="Num +eric"><Value value=""/></Attribute> <Attribute name="Remaining quota per month and period" basicType="Nume +ric"><Value value="7344.0000"><DimensionKey dimensionName="Month" in +dex="0" value="0" name=""/><DimensionK ey dimensionName="Period" index="0" value="0" name=""/></Value></Attr +ibute> <Attribute name="Utilized quota per month and period" basicType="Numer +ic"><Value value="156.0000"><DimensionKey dimensionName="Month" inde +x="0" value="0" name=""/><DimensionKey dimensionName="Period" index="0" value="0" name=""/></Value></Attrib +ute> <Attribute name="Remaining quota to be rolled" basicType="Numeric"><Va +lue value=""/></Attribute> <Attribute name="Number of rolled cycles" basicType="Numeric"><Value v +alue="0"/></Attribute> <Attribute name="Full quota per period" basicType="Numeric"><Value val +ue="7500"><DimensionKey dimensionName="Period" index="0" value="0" n +ame=""/></Value></Attribute> <Attribute name="Limit quota" basicType="Numeric"><Value value="-1"><D +imensionKey dimensionName="Index" index="0" value="0" name=""/></Val +ue><Value value="-1"><DimensionKey di mensionName="Index" index="1" value="1" name=""/></Value></Attribute> <Attribute name="Remaining quota per subscriber" basicType="Numeric">< +Value value="-1"><DimensionKey dimensionName="Index" index="0" value +="0" name=""/></Value><Value value="-1 "><DimensionKey dimensionName="Index" index="1" value="1" name=""/></ +Value></Attribute> <Attribute name="Utilized quota per subscriber" basicType="Numeric"><V +alue value="0"><DimensionKey dimensionName="Index" index="0" value=" +0" name=""/></Value><Value value="0">< DimensionKey dimensionName="Index" index="1" value="1" name=""/></Val +ue></Attribute> <Attribute name="Subscriber ID list" basicType="Numeric"><Value value= +"15846291"><DimensionKey dimensionName="Index" index="0" value="0" n +ame=""/></Value><Value value="15613501 "><DimensionKey dimensionName="Index" index="1" value="1" name=""/></ +Value></Attribute> </PerformanceIndicator>

In reply to XML Parsing by munjalm

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.