kevind0718 has asked for the wisdom of the Perl Monks concerning the following question:
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>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: defined or undef
by ikegami (Patriarch) on Oct 30, 2007 at 14:54 UTC | |
by Fletch (Bishop) on Oct 30, 2007 at 14:57 UTC | |
by kevind0718 (Scribe) on Oct 30, 2007 at 15:18 UTC | |
by ikegami (Patriarch) on Oct 30, 2007 at 15:20 UTC | |
by kevind0718 (Scribe) on Oct 30, 2007 at 15:49 UTC | |
by kevind0718 (Scribe) on Oct 30, 2007 at 15:56 UTC | |
|
Re: defined or undef
by Jenda (Abbot) on Oct 31, 2007 at 21:07 UTC |