SPUG: XML::Simple

Ryan Ames ryan at e-valuations.com
Thu Dec 6 20:27:19 CST 2001


Hello,
	I am parsing a xml file using xml::simple and getting the
following data structure when using Data::Dumper.  
This is my call to XMLin():

my $xsl = XML::Simple->new(forcearray => ['page','question','answer']);

forcearray is supposed to force the items listed into array context.  It
is for 'page' and 'answer' but not for 'question'.  
Any reason for it not doing 'question'? 
Also, I am needing to grab the values of the 'answer_id' but I can't
seem to figure out how to reference them.  Any help 
would be appreciated.  Thanks.



$VAR1 = {
         
          'pages' => {
                       'page' => [
                                   {
                                    
                                     'questions' => {
                                                      'question' => {
 
'HASH(0x837d908)' => {
 

 
'answers' => {
 
'answer' => [
 
{
 

 
'answer_id' => 257993
 
},
 
{
 

 
'answer_id' => 257994
 
},
 
{
 

 
'answer_id' => 257995
 
},
 
{
 

 
'answer_id' => 257996
 
},
 
{
 

 
'answer_id' => 257997
 
}
 
]
 
},
 

 
'ordering_question_id' => {}
 
}
                                                                    }
                                                    },
                                    
                                     'points' => {}
                                   }
                                 ]
                     },
          'session_id' => 810,
        
        };



Ryan





 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list