in reply to Jointly parsing characters and entities in XML::Twig
You have it nearly right, you just have to replace char_handler by text_output_filter, and everything works OK.
I strongly suspect (I have to check) that what happens is that during the parsing, XML::Twig receives 3 events for the data element, 1 before the entity, 1 for the entity, and 1 after the entity. As of now, the char_handler is thus called 3 times, which might be considered a bug, I'll look into it. By using text_output_filter the substitution is performed later, once the 3 texts have been merged.
Does that solve your problem?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Jointly parsing characters and entities in XML::Twig
by eff_i_g (Curate) on Sep 12, 2008 at 16:56 UTC | |
by mirod (Canon) on Sep 12, 2008 at 17:15 UTC |