Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

In reply to XML::Smart blessed object by clintonm9

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (4)
    As of 2019-11-13 02:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Strict and warnings: which comes first?



      Results (68 votes). Check out past polls.

      Notices?