Hi,

Following is the xml file which I have. Now in this file, I need all the values between fields <FormattedReportObjects>xyz</FormattedReportObjects>, thus I need all such "xyz" values and want to store in an array. Can anyone help me to do that ?

Thanks.

<?xml version="1.0" encoding="UTF-8" ?> - <FormattedReport xmlns="urn:crystal-reports:schemas" xmlns:xsi="http +://www.w3.org/2000/10/XMLSchema-instance"> - <FormattedAreaPair Level="0" Type="Report"> - <FormattedArea Type="Header"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedSubreport"> <ObjectName>Subreport1</ObjectName> - <FormattedAreaPair Level="0" Type="Report"> - <FormattedArea Type="Header"> - <FormattedSections> - <FormattedSection SectionNumber="0"> <FormattedReportObjects /> </FormattedSection> - <FormattedSection SectionNumber="1"> <FormattedReportObjects /> </FormattedSection> </FormattedSections> </FormattedArea> - <FormattedAreaPair Level="1" Type="Details"> - <FormattedArea Type="Details"> - <FormattedSections> - <FormattedSection SectionNumber="0"> <FormattedReportObjects /> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> - <FormattedArea Type="Footer"> - <FormattedSections> - <FormattedSection SectionNumber="0"> <FormattedReportObjects /> </FormattedSection> - <FormattedSection SectionNumber="1"> <FormattedReportObjects /> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> - <FormattedSection SectionNumber="1"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedSubreport"> <ObjectName>Subreport2</ObjectName> - <FormattedAreaPair Level="0" Type="Report"> - <FormattedArea Type="Header"> <FormattedSections /> </FormattedArea> - <FormattedArea Type="Footer"> <FormattedSections /> </FormattedArea> </FormattedAreaPair> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> - <FormattedAreaPair Level="1" Type="Group"> - <FormattedArea Type="Header"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="GroupName ({Data.SYSTEM})"> <ObjectName>Field4</ObjectName> <FormattedValue>System lgloe040</FormattedValue> <Value>System lgloe040</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> - <FormattedAreaPair Level="2" Type="Group"> - <FormattedArea Type="Header"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="GroupName ({Data.TYPE})"> <ObjectName>Field5</ObjectName> <FormattedValue>Type LOG</FormattedValue> <Value>Type LOG</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> - <FormattedAreaPair Level="3" Type="Details"> - <FormattedArea Type="Details"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{Data.OWNER}"> <ObjectName>Field6</ObjectName> <FormattedValue>\</FormattedValue> <Value>\</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{Data.PATH}"> <ObjectName>Field10</ObjectName> <FormattedValue>C:\abc\</FormattedValue> <Value>C:\abc\</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{Data.NAMETYPE}"> <ObjectName>Field16</ObjectName> <FormattedValue>weru3453.log</FormattedValue> <Value>weru3453.log</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_FileSize}"> <ObjectName>Field15</ObjectName> <FormattedValue>4</FormattedValue> <Value>4</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_DateAcc}"> <ObjectName>Field8</ObjectName> <FormattedValue>12/12/2005</FormattedValue> <Value>12/12/2005</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_DateMod}"> <ObjectName>Field9</ObjectName> <FormattedValue>12/12/2005</FormattedValue> <Value>12/12/2005</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_DateCre}"> <ObjectName>Field11</ObjectName> <FormattedValue>12/12/2005</FormattedValue> <Value>12/12/2005</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> - <FormattedAreaPair Level="3" Type="Details"> - <FormattedArea Type="Details"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{Data.OWNER}"> <ObjectName>Field6</ObjectName> <FormattedValue>\</FormattedValue> <Value>\</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{Data.PATH}"> <ObjectName>Field10</ObjectName> <FormattedValue>C:\abc\</FormattedValue> <Value>C:\abc\</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{Data.NAMETYPE}"> <ObjectName>Field16</ObjectName> <FormattedValue>sdfsdfs.log</FormattedValue> <Value>sdfsdfs.log</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_FileSize}"> <ObjectName>Field15</ObjectName> <FormattedValue>4</FormattedValue> <Value>4</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_DateAcc}"> <ObjectName>Field8</ObjectName> <FormattedValue>12/12/2005</FormattedValue> <Value>12/12/2005</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_DateMod}"> <ObjectName>Field9</ObjectName> <FormattedValue>12/12/2005</FormattedValue> <Value>12/12/2005</Value> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_DateCre}"> <ObjectName>Field11</ObjectName> <FormattedValue>12/12/2005</FormattedValue> <Value>12/12/2005</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> - <FormattedArea Type="Footer"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_FileSizeSum_Typ}"> <ObjectName>Field24</ObjectName> <FormattedValue>8</FormattedValue> <Value>8</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> - <FormattedArea Type="Footer"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedText"> <ObjectName>Text10</ObjectName> <TextValue>System Total</TextValue> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_FileSizeSum_Sys}"> <ObjectName>Field17</ObjectName> <FormattedValue>8</FormattedValue> <Value>8</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> - <FormattedArea Type="Footer"> - <FormattedSections> - <FormattedSection SectionNumber="0"> - <FormattedReportObjects> - <FormattedReportObject xsi:type="CTFormattedText"> <ObjectName>Text11</ObjectName> <TextValue>Report Total</TextValue> </FormattedReportObject> - <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" + FieldName="{@DBS_FileSizeSum_Rpt}"> <ObjectName>Field25</ObjectName> <FormattedValue>8</FormattedValue> <Value>8</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> </FormattedReport>

Formatting fixed by GrandFather


In reply to parsing xml file and get the values by devlele

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.