Project

General

Profile

« Previous | Next » 

Revision 1563

xml_dom.py: minidom modifications: Escape as many text strings as we use directly. This still leaves the tagName used by xml.dom.minidom.Element.writexml: It uses 'writer.write(indent+"<" + self.tagName)' and doesn't escape the tagName.

View differences:

lib/xml_dom.py
215 215
minidom.Node.__repr__ = __Node_str
216 216
minidom.Element.__repr__ = __Node_str
217 217

  
218
def __Attr_str(self): return self.name+'="'+escape(self.value)+'"'
218
def __Attr_str(self): return escape(self.name)+'="'+escape(self.value)+'"'
219 219
minidom.Attr.__str__ = __Attr_str
220 220
minidom.Attr.__repr__ = __Attr_str
221 221

  
......
226 226
minidom.Node.clear = __Node_clear
227 227

  
228 228
def __Element_write_opening(self, writer, indent='', addindent='', newl=''):
229
    writer.write(indent+'<'+self.tagName)
229
    writer.write(indent+'<'+escape(self.tagName))
230 230
    for attr_idx in xrange(self.attributes.length):
231 231
        writer.write(' '+str(self.attributes.item(attr_idx)))
232 232
    writer.write('>'+newl)
233 233
minidom.Element.write_opening = __Element_write_opening
234 234

  
235 235
def __Element_write_closing(self, writer, indent='', addindent='', newl=''):
236
    writer.write('</'+self.tagName+'>'+newl)
236
    writer.write('</'+escape(self.tagName)+'>'+newl)
237 237
minidom.Element.write_closing = __Element_write_closing
238 238

  
239 239
_writexml_orig = minidom.Element.writexml

Also available in: Unified diff