commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8428 - trunk/gnue-common/src/definitions


From: reinhard
Subject: [gnue] r8428 - trunk/gnue-common/src/definitions
Date: Wed, 19 Apr 2006 05:31:30 -0500 (CDT)

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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]