Posted on 2007-06-30 19:17:18-07 by jeunice
Coalescing adjacent #PCDATA elements?
In processing Open Document Text (ODT) files, I remove some elements, so that the (much simplified) structure
text:p #PCDATA text:s #PCDATA text:s #PCDATA
becomes
text:p #PCDATA #PCDATA #PCDATA
Unfortunately, subs_text doesn't seem to work across #PCDATA elements. What is the best way to coalesce them into a single element, within which subs_text should work? I can certainly concatenate the elements' pcdata() contents, but I'm wary of causing unintended consequences (say with character encodings, a topic on which I'm a little fuzzy), or missing some more elegant and robust solution already built into XML::Twig. Thoughts?
Direct Responses: 5592 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.