How to check if a node is null in XML parser
Ben Goswami (ben.goswami@infospace.com)
Fri, 20 Apr 2001 11:28:41 -0700
Sorry!! there was a typo ... in the last mail:
Hi
how do I check if a node is null. here is the piece of code
**************************
my $itemNodes = $cartNode->getElementsByTagName (ITEM_NODE_NAME);
for ..() {
$itemnode = $itemNodes->item ($i);
if (!$itemNode) {
croak "ERROR:getItemVariation : itemnode not found";
}
}
******************
The code like <if (!$itemnode)> is not working to check for null correctly:
It
does not work when I do getChildnode alos instead of getElementsbyTag ..
thx
BG