more useful options | |
PerlMonks |
XML::XPath and preserving CDATA fieldsby mfriedman (Monk) |
on May 30, 2002 at 02:45 UTC ( [id://170286]=perlquestion: print w/replies, xml ) | Need Help?? |
mfriedman has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed Monks:
I am currently using XML::XPath to extract and change some nodes in an XML document. I use code similar to the following: I am then retrieving the modified XML thusly:
NOTE: I'm not sure if all the syntax above is exactly correct - I just wrote it out from memory, since the actual code is not in front of me right now. This all works fine, except for one thing. When I retrieve the modified XML from the $xpath object, the CDATA fields surrounding certain data have disapeared, and XML::XPath has accidentally escaped some characters that shouldn't be. As an example, the XML Comes back as: I think I know why the CDATA field disapears; the parser is returning the content of the field to XML::XPath but not the information that it is a CDATA. The problem is that this XML must then go to an XSL transformer (Sablotron, in this case) and it's broken. I would appreciate dearly any insight into this matter. Thanks, -Mike
Back to
Seekers of Perl Wisdom
|
|