sub getCBLValue { my ($cblIn, $cbNameIn); my @cdn = undef; my $textEl = undef; my @rtnVal = undef; # return the CustomBucketValue element #** ** ** ** ** ** ** ** ** # pass in the customBucketList and the name of the # dimension to look for ($cblIn, $cbNameIn) = @_; foreach my $cb ( $cblIn->getChildNodes() ) { if ($cb->getNodeType() == ELEMENT_NODE && $cb->getNodeName() eq 'customBucket' ) { print '$cb node name: ' .$cb->getNodeName() . ' type: ' . n +odeTypeText($cb->getNodeType() ) . "\n"; #scanner( $cb ); @cdn = $cb->getElementsByTagName("customDimensionName", 0); #print scalar @cdn; $textEl = $cdn[0]->getFirstChild(); if ( $textEl->getData() eq $cbNameIn ) { print "\n Assignment to rtnVal "; @rtnVal = $cb->getElementsByTagName("customBucketValue", 0); last; } } # if customBucket node } # foreach print "\n Return from getCBLValue: " ; print ( defined(@rtnVal) ? " defined \n" : " undefined \n" ); return @rtnVal; } # getCBLValue
<customBucketList> <customBucket> <customDimensionName>GSEC_SecuritySubType</customDimensionName> <customBucketValue>1041</customBucketValue> </customBucket> <customBucket> <customDimensionName>IssuerCountryOfDomicile</customDimensionName> <customBucketValue>US</customBucketValue> </customBucket> <customBucket> <customDimensionName>icbSubSector</customDimensionName> <customBucketValue>Banks</customBucketValue> </customBucket> <customBucket> </customBucketList>
In reply to defined or undef by kevind0718
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |