[Serialization/Archive] Handle comments in xml-files
Hi, can anyone tell me where in the code I can find the place, where I can disable comment-processing as normal name-value-pairs? Because If I have xml-comments (<!-- -->) in the xml-file, the deserialization will fail with a boost::archive::archive_exception. Thanks in advance for your help! Gerrit
It might be better to just strip the comments first. This XSL will do that: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <!-- Copy everything --> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <!-- Emit nothing for comments --> <xsl:template match="comment()"> </xsl:template> </xsl:stylesheet> This might or might not be an option for you, but it seems less likely to introduce problems. John -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Gerrit Brehmer Sent: Friday, April 20, 2007 4:48 AM To: Boost-users@lists.boost.org Subject: [Boost-users] [Serialization/Archive] Handle comments in xml-files Hi, can anyone tell me where in the code I can find the place, where I can disable comment-processing as normal name-value-pairs? Because If I have xml-comments (<!-- -->) in the xml-file, the deserialization will fail with a boost::archive::archive_exception. Thanks in advance for your help! Gerrit _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
This would require upgrading the sprite parser grammar used for parsing the xml input. Not a big job for someone already familiar with spirit but there IS a learning curve for this!!!. Robert Ramey Gerrit Brehmer wrote:
Hi,
can anyone tell me where in the code I can find the place, where I can disable comment-processing as normal name-value-pairs? Because If I have xml-comments (<!-- -->) in the xml-file, the deserialization will fail with a boost::archive::archive_exception.
Thanks in advance for your help! Gerrit
participants (3)
-
Gerrit Brehmer
-
John Wilkinson
-
Robert Ramey