There are tons of XML modules, many of which make that sort of thing easy...
but it depends on exactly what you want to do.  Here are some snippets:

use XML::EasyOBJ;

my $obj = new XML::EasyOBJ('killme.xml');

foreach ( $obj->albums ) {
        print $_->owner->getString . "\n";
}

-- OR --

use XML::RAX;

my $rax = new XML::RAX;

$rax->openfile('killme.xml');
$rax->setRecord('albums');

while ( my $rec = $rax->readRecord ) {
        print $rec->getField('owner') . "\n";
}

....And there are *LOTS* more.  It all depends on what you need to do.

BTW - The current version of XML::EasyOBJ on CPAN is a bit old.  I have a
newer version that includes read and write capabilities but I haven't
written up the new docs for it yet.  I can send it if you wanted.

Rob




-----Original Message-----
From: P0R0NG [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 8:10 AM
To: [EMAIL PROTECTED]
Subject: Re: PERL and XML Parser


On Fri, 1 Feb 2002 21:04:54 +0800
P0R0NG <[EMAIL PROTECTED]> wrote:

|how can i get the PCDATA for the element "owner"? i want to get just 
|the "owner" elements and the content of the "owner."
|
|i've created a code that will trap for the start and end tags of 
|the element "owner" as well as the handlers for the characters 
|that were part of the markup but no particular handlers.

i forgot, my code was getting all the contents with no particular handlers.
(ie contents of "rock", "reggae", "owner" elements were trapped. all i want 
is the content of the "owner" elements.

thanks again.

percy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to