develooper Front page | perl.beginners | Postings from April 2012

XML::Mini question

Thread Next
From:
Manfred Lotz
Date:
April 18, 2012 12:41
Subject:
XML::Mini question
Message ID:
20120418214111.0f7de68a@arcor.com
Hi there,
I've got a question about XML::Mini. 

When parsing an xml document for some reasons I want to preserve white
space. However, it doesn't work really.

Minimal example:

! /usr/bin/perl


use strict;
use warnings;
use Data::Dumper;
use XML::Mini::Document;

my $XMLString = "<book>  Learning Perl </book>";        
        
my $xmlDoc = XML::Mini::Document->new();
        
$XML::Mini::IgnoreWhitespaces = 0;

# init the doc from an XML string
$xmlDoc->parse($XMLString);
        
my $xmlHash = $xmlDoc->toHash();
        
print Dumper($xmlHash);


I get the following output:
VAR1 = {
          'book' => 'Learning Perl '
        };


I would have expecte to have 
   book' => '  Learning Perl '

instead.


Any idea, what's going wrong? 


-- 
Manfred




Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About