in reply to Need Help Understanding Parsing XML into multi level struck

my @list (field1, field2); my @subList (subField1, subField2, subField3, subField4);

What are those lines doing? For me they don't even compile. Is this some pseudocode notation I should be privy to?


Dave

Replies are listed 'Best First'.
Re: Re: Need Help Understanding Parsing XML into multi level struck
by ralibm (Acolyte) on Mar 17, 2004 at 23:25 UTC
    Yes this is pseudo code. The data stream that feeds the tree is proprietary.

    The lines you've highlighted are used to control the outer and inner loops. The list elements are also used to identify the nodes in the structs.

    So basically it will look something like this:

    self => Field1 => { subField1 => 'thingy1' subField2 => 'thingy2' subField3 => 'thingy3' subField4 => 'thingy4' } Field2 => { subField1 => 'thingy1' subField2 => 'thingy2' subField3 => 'thingy3' subField4 => 'thingy4' } }
    I can get this to work when I don't have subfields, but the XML is more granular for the module I'm now building.
      When you use the Data::Dumper module, does your overall structure look like you think it should? For example, do you get the expected output when you say:
      print Dumper $tree;

      Dave

        This is the result after the looping.

        print Dumper($self);
        $VAR1 = bless( { 'TradingStatistics::SharesOutstandingTotal' => bless( + { 'SubFields::content' => undef, 'SubFields::Description' => undef, 'SubFields::Type' => undef, 'SubFields::modDate' => undef }, 'SubFields' ), 'TradingStatistics::ShortInterestRatio' => bless( { 'SubFields::content' => undef, 'SubFields::Description' => undef, 'SubFields::Type' => undef, 'SubFields::modDate' => undef .........
        Here's the tree slightly scrubed.

        print Dumper($tree);
        $VAR1 = { 'TradingStatisticsIRMXL' => { 'TradingStatistics' => { 'HalfYearChange' => {}, 'InstitutionsHoldingShares' => {}, 'YearChange' => {}, ..... $VAR1 = { 'CorpMasterID' => '', 'TradingStatisticsIRXML' => { 'TradingStatistics' => { 'HalfYearChange' => { 'Description' => '26-Week Price Percent Change', 'content' => ', 'Type' => 'PriceAndVolume' }, 'InstitutionsHoldingShares' => { 'Description' => 'Institutions Holding Shares', 'content' 'Type' => 'InstitutionalHoldings' ..... },
        As you can see there's a new hash inserted into the top of the tree that looks like the struct that I'm trying to build but without data, and the struct doesn't contaiin any either.

        This is where I'm at a loss since my previou module is almost a duplicate except that it use a single level struct, with one loop.