Author: reinhard
Date: 2006-04-19 05:31:30 -0500 (Wed, 19 Apr 2006)
New Revision: 8428
Modified:
trunk/gnue-common/src/definitions/GObjects.py
Log:
Added general option to store content as CDATA.
Modified: trunk/gnue-common/src/definitions/GObjects.py
===================================================================
--- trunk/gnue-common/src/definitions/GObjects.py 2006-04-19 10:29:41 UTC
(rev 8427)
+++ trunk/gnue-common/src/definitions/GObjects.py 2006-04-19 10:31:30 UTC
(rev 8428)
@@ -74,7 +74,11 @@
self._inits = []
+ # Descendants can set this to True if they want their content to be saved
+ # within <![CDATA[...]]>
+ self._xml_content_as_cdata_ = False
+
# ---------------------------------------------------------------------------
# Dictionary style attribute access
# ---------------------------------------------------------------------------
@@ -530,9 +534,14 @@
xmlString += ">\n"
if treeDump:
+ if hasContent and self._xml_content_as_cdata_:
+ xmlString += "<![CDATA["
for child in self._children:
xmlString += child.dumpXML (lookupDict, True, gap + " ",
- xmlnamespaces, textEncoding, stripPrefixes)
+ xmlnamespaces, textEncoding, stripPrefixes,
+ (not self._xml_content_as_cdata_) and escape)
+ if hasContent and self._xml_content_as_cdata_:
+ xmlString += "]]>"
if hasContent:
xmlString += "</%s%s>\n" % (xmlns, xmlEntity)
_______________________________________________
commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue