Adding support for unescape special character in #text node in formattedText
authorlaurent
Mon, 12 Dec 2011 00:38:24 +0100
changeset 602 7cadf0e2ae05
parent 601 32c0f4a626db
child 603 25c92309cdae
Adding support for unescape special character in #text node in formattedText
xmlclass/xmlclass.py
--- a/xmlclass/xmlclass.py	Mon Dec 12 00:25:18 2011 +0100
+++ b/xmlclass/xmlclass.py	Mon Dec 12 00:38:24 2011 +0100
@@ -131,8 +131,8 @@
         # content is a CDATA
         text = ""
         for node in attr.childNodes:
-            if node.nodeName != "#text":
-                text += node.data.encode("utf-8")
+            if not (node.nodeName == "#text" and node.data.strip() == ""):
+                text += unescape(node.data.encode("utf-8"))
         return text
 
 
@@ -535,7 +535,7 @@
 def GenerateAnyInfos(infos):
     def ExtractAny(tree):
         if tree.nodeName in ["#text", "#cdata-section"]:
-            return tree.data.encode("utf-8")
+            return unescape(tree.data.encode("utf-8"))
         else:
             return tree