You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Jason Stewart <ja...@gmail.com> on 2006/10/24 07:30:30 UTC
Re: "Can't locate" errors with XML:Xerces
Hi,
The correct list for Perl questions is p-dev@xerces.apache.org
On 10/23/06, Jaideep Padhye <jd...@yahoo.com> 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org
Re: "Can't locate" errors with XML:Xerces
Posted by Jason Stewart <ja...@gmail.com>.
Hi JD,
You're welcome. Let us know how things progress.
Cheers, jas.
On 10/25/06, Jaideep Padhye <jd...@yahoo.com> wrote:
> Hi Jason,
>
> Thanks a lot for your help. Sorry for not giving the complete code example.
> I just needed help in understanding what that error meant. Now I resolved
> the problem with your help.
>
> JD
>
> Jason Stewart <ja...@gmail.com> wrote:
> Hi,
>
> The correct list for Perl questions is p-dev@xerces.apache.org
>
> On 10/23/06, Jaideep Padhye 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.
>
>
>
> -------------------------------------------
> "A billion flies can be wrong !!
> I would rather eat lamb chops than shit "
> - Linus Torwalds
> -------------------------------------------
>
> ________________________________
> How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates.
---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org