Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

XML::Smart blessed object

by clintonm9 (Sexton)
on Nov 30, 2009 at 05:50 UTC ( #810067=perlquestion: print w/replies, xml ) Need Help??

clintonm9 has asked for the wisdom of the Perl Monks concerning the following question:

Currently I am using XML::Smart to take XML data and turn it into Perl hash ref. When I do this it gives me a blessed object. Using data dumper I get the following:

$VAR1 = bless( do{\(my $o = bless( { 'keyprev' => [ 'Root' ], 'tree' => { 'Root' => { 'Division' => '1', 'customFields_12591667 +92386590' => '1259166853029400', 'Salary' => '$11,000', 'OpeningTypeInternal' +=> '0', 'Department' => '1', 'EmployeeType' => '2', 'OpeningTypeNew' => '0 +', 'RecommendedSkills' => + { + '/order' => [ + 'Competency', + 'Skill' + ], + 'Skill' => '1251899844300030', + 'Competency' => '1' } +, 'UploadedFilePath1' => + '/tmp/upload.txt', 'DirectSupervisor' => +'1234480034844500', 'customFields_12591675 +36111070' => 'This is test\\n Yeah!!', 'OpeningTitle' => 'Thi +s is a test 12212', 'CreatedBy' => '123448 +0034844500', 'EmployeePosition' => +'2', 'customFields_12591675 +18649600' => '1', 'customFields_12590011 +70796260' => '123', 'MinEducation' => '3', 'customFields_12589992 +42293800' => '1258999242297140', 'JobBenefits' => 'Bene +fits!22', 'MinExperience' => '2' +, 'Location' => '1', 'customFields_12587841 +16329220' => 'This is my text 1a!', '/order' => [ 'Availab +leDate', 'Created +By', 'Departm +ent', 'DirectS +upervisor', 'Divisio +n', 'Employe +ePosition', 'Employe +eType', 'JobBene +fits', 'Locatio +n', 'MinEduc +ation', 'MinExpe +rience', 'Opening +Title', 'Opening +TypeInternal', 'Opening +TypeNew', 'RemoteU +RL', 'Salary' +, 'Transac +tionKey', 'Uploade +dFileName1', 'Uploade +dFileNotes1', 'Uploade +dFilePath1', 'customF +ields_1258784116329220', 'customF +ields_1258998182890350', 'customF +ields_1258999242293800', 'customF +ields_1259001170796260', 'customF +ields_1259166792386590', 'customF +ields_1259167518649600', 'customF +ields_1259167536111070', 'customF +ields_1259167572184420', 'Descrip +tion', 'Recomme +ndedSkills' ], 'AvailableDate' => '11 +/05/2009', 'customFields_12589981 +82890350' => '10/05/2009', '/nodes' => { 'Recomme +ndedSkills' => 1, 'Descrip +tion' => 1 }, 'UploadedFileNotes1' = +> 'This is a test!', 'UploadedFileName1' => + 'upload.txt', 'Description' => { 'CONT +ENT' => 'This is the Descri11ption Yes it is!!' }, 'customFields_12591675 +72184420' => '1111' }, '/order' => [ 'Root' ], '/nodes' => { 'Root' => 1 } }, 'a' => [], 'TIEONUSE' => { 'h' => 'XML::Smart::Tie::Has +h', 'a' => 'XML::Smart::Tie::Arr +ay' }, 'back' => ${$VAR1}->{'tree'}, 's' => \sub { "DUMMY" }, 'key' => 'Root', 'array' => undef, 'c' => sub { "DUMMY" }, 'point' => ${$VAR1}->{'tree'}->{'Root'}, 'h' => {}, 'g' => \*Object::MultiType::Saver::NULL, 'b' => \sub { "DUMMY" }, 'i' => undef }, 'Object::MultiType::Saver' ))}, 'XML::Smart +' );

Now if I print $postdata->{'Division'} it works fine. But if I ref($postdata->{'Division'}) I get XML::Smart istead of hash.

Is there any way to just get the data out of this nasty structure and to something that looks more like XML::Simple would? I do not need to know the order or anything like that. Also XML::Simple doesn’t work for me because of the way it handles different tags.

Any help would be greatly appreciated

Replies are listed 'Best First'.
Re: XML::Smart blessed object
by keszler (Priest) on Nov 30, 2009 at 10:53 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://810067]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2019-10-18 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?