Kernel::System::XML::Simple - Turn XML into a Perl structure
Turn XML into a Perl structure.
create an object. Do not use it directly, instead use:
use Kernel::System::ObjectManager; local $Kernel::OM = Kernel::System::ObjectManager->new(); my $XMLSimpleObject = $Kernel::OM->Get('Kernel::System::XML::Simple');
Turns given XML data into Perl structure. The resulting Perl structure can be in adjusted with options. Available options can be found here: http://search.cpan.org/~markov/XML-LibXML-Simple-0.97/lib/XML/LibXML/Simple.pod#Parameter_%options
# XML from file: my $PerlStructure = $XMLSimpleObject->XMLIn( XMLInput => '/xml/items.xml', Options => { ForceArray => 1, ForceContent => 1, ContentKey => 'Content', }, ); # XML from string: my $PerlStructure = $XMLSimpleObject->XMLIn( XMLInput => '<MyXML><Item Type="String">My content</Item><Item Type="Number">23</Item></MyXML>', Options => { ForceArray => 1, ForceContent => 1, ContentKey => 'Content', }, ); Results in: my $PerlStructure = { Item => [ { Type => 'String', Content => 'My content', }, { Type => 'Number', Content => '23', }, ], };
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.