[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-xml
Subject:    Re: XML::XPath::PerlSAX
From:       Matt Sergeant <matt () sergeant ! org>
Date:       2001-03-16 22:51:29
[Download RAW message or body]

On Fri, 16 Mar 2001, Duncan Cameron wrote:

> Matt
> 
> I'm trying to use the XPath PerlSAX module but am having trouble with
> understanding how to access nodes.
> 
> Each XPath node seems to contain a corresponding implementation
> object. The PerlSAX module refers to nodes as if they were
> implementation objects, so the array dereferencing is invalid.
> 
> For example:
> 
> my $generator = XML::XPath::PerlSAX->new( Handler => $handler );
> 
> foreach my $node ($paras->get_nodelist) {
>     my $domtree = $generator->parse($node);
>    # do something with $domtree
> }
> 
> $node may be a XML::XPath::Node::Element, but parse is expecting
> XML::XPath::Node::ElementImpl, or at least something which it can
> dereference as an array, $node->[node_text]
> 
> Can you clarify how this is meant to work?

Try doing $node->_to_sax($handler);

Unfortunately the PerlSAX stuff isn't well tested and has probably fallen
behind the times, and so the above unfortunately uses a private method :-(

Patches welcome :-)

-- 
<Matt/>

    /||    ** Founder and CTO  **  **   http://axkit.com/     **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
     \\//
     //\\
    //  \\

_______________________________________________
Perl-XML mailing list
Perl-XML@listserv.ActiveState.com
http://listserv.ActiveState.com/mailman/listinfo/perl-xml

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic