"Beginner" question on parsing XML file with XML::Simple

Johan Landerholm <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
Hi all,

I understand there is a lot of very talented people on this mailing list.

I would consider myself a bad programmer even though I'm been in the 
Unix industry for 20 years.
I have just come across a XML parsing problem that I thought perl would 
be good in solving for me.
But, I have struggled with the XML::Simple module to get the information 
from a xml report that I get from a system.

If someone is willing to help me with this problem, I would be very 
thankful!

I have a report that I need to pull a few pieces of data from and do 
something else with.
The report looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<ReportOutput>
    <ReportHead>
        <Report oid="-1y2p0ij32e7uh:-1y2p0ij30wn8z" name="export log" 
type="systemlog_rpt">
            <Description>Test report</Description>
        </Report>
    </ReportHead>
    <ReportBody>
        <ReportSection name="messages" category="messages">
            <ReportSection name="12/14/08 7:15 AM" category="message">
                <String name="user">administrator</String>
                <Timestamp name="messageTime" displayvalue="12/14/08 
7:15 AM">1229267714000</Timestamp>
                <String name="message">Modified Rule 'test rule'.

Added '/bin'.
</String>
                <String name="level">Information</String>
                <String name="category">Rule Change</String>
            </ReportSection>
        </ReportSection>
        <ReportSection name="reportTotals" category="reportTotals">
            <Integer name="summary.messages">1</Integer>
            <Integer name="summary.information">1</Integer>
            <Integer name="summary.error">0</Integer>
        </ReportSection>
    </ReportBody>
</ReportOutput>

The information that I need is the <String 
name="user">*administrator*</String> and the <String 
name="message">*Modified Rule 'test rule'. Added '/bin'.*</String>.
How is it possible to find this information in a perl script ?
I have tried to use the examples in the documentation but I can't get it 
right ?

Am I using the correct module ?
Has anyone any suggestions on how to do this ?

Best regards,
Johan


_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.