Lines Matching refs:text

69 def _raise_serialization_error(text):
71 "cannot serialize %r (type %s)" % (text, type(text).__name__)
74 def _encode(text, encoding):
76 return text.encode(encoding, "xmlcharrefreplace")
78 _raise_serialization_error(text)
80 def _escape_cdata(text, encoding):
86 if "&" in text:
87 text = text.replace("&", "&")
88 if "<" in text:
89 text = text.replace("<", "&lt;")
90 if ">" in text:
91 text = text.replace(">", "&gt;")
92 return text.encode(encoding, "xmlcharrefreplace")
94 _raise_serialization_error(text)
97 def _escape_attrib(text, encoding):
100 if "&" in text:
101 text = text.replace("&", "&amp;")
102 if "<" in text:
103 text = text.replace("<", "&lt;")
104 if ">" in text:
105 text = text.replace(">", "&gt;")
106 if "\"" in text:
107 text = text.replace("\"", "&quot;")
108 if "\n" in text:
109 text = text.replace("\n", "&#10;")
110 return text.encode(encoding, "xmlcharrefreplace")
112 _raise_serialization_error(text)
114 def _escape_attrib_html(text, encoding):
117 if "&" in text:
118 text = text.replace("&", "&amp;")
119 if ">" in text:
120 text = text.replace(">", "&gt;")
121 if "\"" in text:
122 text = text.replace("\"", "&quot;")
123 return text.encode(encoding, "xmlcharrefreplace")
125 _raise_serialization_error(text)
130 text = elem.text
132 write("<!--%s-->" % _escape_cdata(text, encoding))
134 write("<?%s?>" % _escape_cdata(text, encoding))
138 if text:
139 write(_escape_cdata(text, encoding))
149 k = k.text
151 v = qnames[v.text]
168 if text:
170 write(_encode(text, encoding))
172 write(_escape_cdata(text, encoding))
211 def encode(text):
212 return text.encode(encoding)
248 if isinstance(tag, QName) and tag.text not in qnames:
249 add_qname(tag.text)
257 key = key.text
260 if isinstance(value, QName) and value.text not in qnames:
261 add_qname(value.text)
262 text = elem.text
263 if isinstance(text, QName) and text.text not in qnames:
264 add_qname(text.text)