Hi Octavian,

On Sun, 28 Oct 2012 17:45:15 +0200
"Octavian Rasnita" <orasn...@gmail.com> wrote:

> From: "Shlomi Fish" <shlo...@shlomifish.org>
> 
> Hi Octavian,
> 
> 
> 
> Hi Shlomi,
> 
> I tried to use XML::LibXML::Reader which uses the pool parser, and I read 
> that:
> 
> ""
> However, it is also possible to mix Reader with DOM. At every point the
> user may copy the current node (optionally expanded into a complete
> sub-tree) from the processed document to another DOM tree, or to
> instruct the Reader to collect sub-document in form of a DOM tree
> ""
> 
> So I tried:
> 
> use XML::LibXML::Reader;
> 
> my $xml = 'path/to/xml/file.xml';
> 
> my $reader = XML::LibXML::Reader->new( location => $xml ) or die "cannot 
> read $xml";
> 
> while ( $reader->nextElement( 'Lexem' ) ) {
>     my $id = $reader->getAttribute( 'id' ); #works fine
> 
>     my $doc = $reader->document;
> 
>     my $timestamp = $doc->getElementsByTagName( 'Timestamp' ); #Doesn't work 
> well
>     my @lexem_text = $doc->getElementsByTagName( 'Form' ); #Doesn't work 
> fine
> 
> }
> 

I'm not sure you should do ->document. I cannot tell you off-hand how to do it
right, but I can try to investigate when I have some spare cycles.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

What does “IDK” stand for? I don’t know.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to