W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

Re: getData - Elements/Nodes will null values

From: osdx <osdx@etang.com>
Date: Mon, 16 Apr 2001 17:22:28 +0800 (CST)
Message-Id: <3ADAB9D4.04053@mail-smtp2>
To: www-dom@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:48 GMT