BenHopkins has asked for the wisdom of the Perl Monks concerning the following question:
Here's the output:<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE nitf SYSTEM "../CCI-DTD/nitf-3-1.dtd" [ <!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for X +HTML//EN" "../CCI-DTD/xhtml-lat1.ent"> %HTMLlat1; <!ENTITY % HTMLsymbol PUBLIC "-//W3C//ENTITIES Symbols for + XHTML//EN" "../CCI-DTD/xhtml-symbol.ent"> %HTMLsymbol; <!ENTITY % HTMLspecial PUBLIC "-//W3C//ENTITIES Special fo +r XHTML//EN" "../CCI-DTD/xhtml-special.ent"> %HTMLspecial; ]>
The square brackets surrounding the three !ENTITY declarations are missing. Here's the program's new declaration:<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE nitf SYSTEM "../CCI-DTD/nitf-3-1.dtd"> <!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for X +HTML//EN" "../CCI-DTD/xhtml-lat1.ent"> %HTMLlat1; <!ENTITY % HTMLsymbol PUBLIC "-//W3C//ENTITIES Symbols for + XHTML//EN" "../CCI-DTD/xhtml-symbol.ent"> %HTMLsymbol; <!ENTITY % HTMLspecial PUBLIC "-//W3C//ENTITIES Special fo +r XHTML//EN" "../CCI-DTD/xhtml-special.ent"> %HTMLspecial; >
At first I didn't have keep_encoding, and then besides the missing square brackets, the first !ENTITY was also missing. keep_encoding restored the first !ENTITY, but not the brackets.my $t = XML::Twig->new( twig_roots => { "$nitf_root/body/body.head/hedline/hl1" => \&f +ix_hl1, "$nitf_root/body/body.head/hedline/hl2" => \&f +ix_hl2, }, twig_print_outside_roots => 1, keep_encoding => 1, );
Any ideas?
(I do a flush after the parse, so it's not that, althought I don't see how it could affect anything, I saw something about it.)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: XML::Twig problem
by mirod (Canon) on May 31, 2007 at 06:34 UTC | |
Re: XML::Twig problem
by mirod (Canon) on May 31, 2007 at 11:23 UTC | |
by BenHopkins (Sexton) on May 31, 2007 at 22:12 UTC | |
by mirod (Canon) on Jun 01, 2007 at 07:55 UTC |