Re: getData - Elements/Nodes will null values

At first you should judge if a node has childnodes (0)? If it has.you should get the length of childnodes (1) and get each childnode's nodetype (2).Here you can use a Switch to judge the childnode's nodetype.1 means the type of child is node,3 means the type of child is text.

0. ->hasChildNodes()

1. ->Getlength()

2. ->GetnodeType()




>
>Hi 
>
>I am having success with this command, with the exception of nodes that
>return NULL values. That is, the node actaully exists but there is no data
>for that node.
>eg:  <SellerPartNumber></SellerPartNumber>
>
>In addition I am using the following commands.
>	my $LineProdCode = $line->getElementsByTagName ("SellerPartNumber");
>     $Item  = $LineProdCode->[0]->getFirstChild->getData
>
>It seems to crash on the getData. 
>
> The module seems to be erroring out somewhere. Is there a way of checking
>for nodes that exist in an XML document that have null values. Is there any
>way I can trap any errors caused by the null node scenario. I could not find
>anything in the documentation.
>
>You advice would be greatly appreciated.
>
>Regards
>
>Frank Fumic
>



-----------------------------------------
盛中国小提琴独奏音乐会
http://ecard.etang.com/progt/activity/concert-ticket/index.html
亿唐卡一出,车坛起风云
http://ecard.etang.com/progt/activity/karting/index.html
男人--上海制造
http://dear.etang.com/world/man/index.htm
爱她在心口要开
http://ad2.263.net/cgi-bin/advert/push/redirect.cgi?aid=2725        

Received on Monday, 16 April 2001 05:29:30 UTC