little problem with xml::dom::parser

dear 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:
<?xml version=3D"1.0" encoding=3D"ISO-8859-1" standalone=3D"yes"?>
<doc>
<name>Mathias Wuendisch</name>
</doc>
end source file:

begin perl script:
#!c:\perl\bin\perl.exe -w
use XML::DOM;
use strict;

&process_file( shift [at] 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:
<?xml version=3D"1.0" encoding=3D"ISO-8859-1" standalone=3D"yes"?>
<doc>
<name>Mathias=A0Wuendisch</name>
</doc>
end target file:

i've read the sourceforge faq and i've found a solution for "named
entities" like this:

---
<?xml version=3D"1.0" encoding=3D"ISO-8859-1" standalone=3D"yes"?>
<!DOCTYPE doc [
<!ENTITY nbsp " " >
]>
<doc>
<name>Mathias Wuendisch</name>
</doc>
---

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
wuendi [ Di, 22 Januar 2008 15:39 ] [ ID #1914089 ]
Perl » comp.lang.perl.misc » little problem with xml::dom::parser

Vorheriges Thema: AuthDBI log out is it possible
Nächstes Thema: FAQ 9.4 How do I remove HTML from a string?