little problem with xml::dom::parser
am 22.01.2008 15:39:29 von wuendidear group,
i have a little problem with the automatic conversion from unicode
entities in real characters by XML::DOM::Parser (or XML::Parser). for
example i have the string '&x#A0;' in a xml source file and i want it
after parsing with XML::DOM::Parser also in the target xml file.
begin source file:
end source file:
begin perl script:
#!c:\perl\bin\perl.exe -w
use XML::DOM;
use strict;
&process_file( shift @ARGV );
sub process_file {
my $infile =3D shift;
my $dom_parser =3D new XML::DOM::Parser(NoExpand =3D> 1,
ProtocolEncoding =3D> 'iso-8859-1', ParseParamEnt =3D> 0, ExpandParamEnt
=3D> 0) ;
my $doc =3D $dom_parser->parsefile( $infile ,NoExpand =3D> 1,
ParseParamEnt =3D> 0, ExpandParamEnt =3D> 0) ;
print $doc->toString;
$doc->dispose;
}
exit;
end perl script:
after: perl xml-dom-test.pl test.xml > test1.xml
i have this
begin target file:
end target file:
i've read the sourceforge faq and i've found a solution for "named
entities" like this:
---
]>
---
ok, than the "named entity" is also in the target file... but
what is with "unnamed entities" like &x#A0; ? why did the NoExpand
flag or ExpandParamEnt flag not work for me? any suggestions?
kind regards,
mathias wündisch