http://qs321.pair.com?node_id=1231817


in reply to XML to Hash Truncating Keys Problem

It worked for me after I removed the '%' character from my test xml. With that character included in a text node as shown below the parse function would hang. Perhaps you have some other special character that the XML::Mini::Document module can't handle.

use warnings; use strict; #use 5.24.1; use Data::Dumper qw(Dumper); use XML::Mini::Document; $Data::Dumper::Terse=1; my $xml_input; { local $/; $xml_input = <DATA>; } print "1********************************************\n"; print $xml_input; my $xml_object =XML::Mini::Document->new(); $xml_object->parse($xml_input); #goto END; my $hash_ref = $xml_object->toHash(); print "2********************************************\n"; print Dumper($hash_ref); my $dumped_hash=Dumper($hash_ref); my $evalled_hashdata=eval($dumped_hash); print "3********************************************\n"; print Dumper($evalled_hashdata); END: #exit; ## This will cause ->parse() to hang. ## <BitmapPath>%TEST_ROOT%\bitmaps\</BitmapPath> __DATA__ <?xml version="1.0" encoding="utf-8"?> <NetConfig> <UseServerTimer>false</UseServerTimer> <PhoneNumberRegex /> <InitializeStatistics_Logging>false</InitializeStatistics_Logging> <InitializeStatistics_Logging>false_test</InitializeStatistics_Loggi +ng> <InitializeStatistics_Logging>false test</InitializeStatistics_Loggi +ng> <InitializeStatistics_Logging>false test </InitializeStatistics_Logg +ing> <ViewerConfigs> <TileNamePatern>{0}\{1}\{2}.tile</TileNamePatern> <ViewerConfigWrap> <File>viewerConfigx.xml</File> <Name>FI_RT</Name> </ViewerConfigWrap> </ViewerConfigs> </NetConfig>

Here is the output:

1******************************************** <?xml version="1.0" encoding="utf-8"?> <NetConfig> <UseServerTimer>false</UseServerTimer> <PhoneNumberRegex /> <InitializeStatistics_Logging>false</InitializeStatistics_Logging> <InitializeStatistics_Logging>false_test</InitializeStatistics_Loggi +ng> <InitializeStatistics_Logging>false test</InitializeStatistics_Loggi +ng> <InitializeStatistics_Logging>false test </InitializeStatistics_Logg +ing> <ViewerConfigs> <TileNamePatern>{0}\{1}\{2}.tile</TileNamePatern> <ViewerConfigWrap> <File>viewerConfigx.xml</File> <Name>FI_RT</Name> </ViewerConfigWrap> </ViewerConfigs> </NetConfig> 2******************************************** { 'NetConfig' => { 'PhoneNumberRegex' => '', 'ViewerConfigs' => { 'ViewerConfigWrap' => { 'File' + => 'viewerConfigx.xml', 'Name' + => 'FI_RT' }, 'TileNamePatern' => '{0}\\{1}\ +\{2}.tile' }, 'InitializeStatistics_Logging' => [ 'false', 'false_test', 'false test', 'false test' ], 'UseServerTimer' => 'false' }, 'xml' => { 'version' => '1.0', 'encoding' => 'utf-8' } } 3******************************************** { 'NetConfig' => { 'PhoneNumberRegex' => '', 'UseServerTimer' => 'false', 'InitializeStatistics_Logging' => [ 'false', 'false_test', 'false test', 'false test' ], 'ViewerConfigs' => { 'TileNamePatern' => '{0}\\{1}\ +\{2}.tile', 'ViewerConfigWrap' => { 'File' + => 'viewerConfigx.xml', 'Name' + => 'FI_RT' } } }, 'xml' => { 'version' => '1.0', 'encoding' => 'utf-8' } }