Re: "Can't locate" errors with XML:Xerces

"Jason Stewart" <[email protected]> Tue, 24 Oct 2006 11:00:30 +0530
Newsgroups gmane.text.xml.xerces-p.devel
Message-ID <[email protected]>
Hi,

The correct list for Perl questions is [email protected]

On 10/23/06, Jaideep Padhye <[email protected]> wrote:
> Hi all,
>
> I am not too sure if this is the correct forum to post this problem. If it
> ain't, then kindly redirect me to the correct one.  i am a newbie and  I am
> trying to use the Xerces in my perl script using the Xml:Xerces interface.
> When I execute my script to which works on the DOM object returned from
> parser, I get file not found errors.
>
> Can't locate auto/XML/Xerces/DOMNodeList/getNodeValu.al in
> @INC (@INC contains: blah blah.......) at /root/jd/lib/Xml.pm line 142
>
> Can't locate auto/XML/Xerces/DOMNodeList/hasChildNod.al in
> @INC (@INC contains: blah blah.......) at /root//lib/Xml.pm line 27
>
> I got these errors by using "$node->hasChildNodes()" in my script.
>

You aren't showing enough of your perl code to figure out how $node is set.

The error tells you that $node is an instance of the class DOMNodeList
- which has no hasChildNodes() method - it is a list of nodes not a
node, you will have to iterate through the list. Methods that return a
DOMNodeList object can be forced to return a simple Perl array if you
prefer:

   $dom_list_obj = $node->getChildeNodes() # return DOMNodeList object

  @node_list = $node->getChildeNodes() # return Perl array of DOMNodes

calling it in a scalar context gives you the Xerces List object,
calling it in an array context gives you a Perl list.

HTH, jas.