Customised XML writing - include encoding header attribute
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17553 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
19
wxPython/wxPython/tools/XRCed/myxml.py
Normal file
19
wxPython/wxPython/tools/XRCed/myxml.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Name: myxml.py
|
||||||
|
# Purpose: XRC editor, XML stuff
|
||||||
|
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||||
|
# Created: 15.10.2002
|
||||||
|
# RCS-ID: $Id$
|
||||||
|
|
||||||
|
from xml.dom import minidom
|
||||||
|
|
||||||
|
# Redefine writing to include encoding
|
||||||
|
class MyDocument(minidom.Document):
|
||||||
|
def __init__(self):
|
||||||
|
minidom.Document.__init__(self)
|
||||||
|
self.encoding = ''
|
||||||
|
def writexml(self, writer, indent="", addindent="", newl="", encoding=""):
|
||||||
|
if encoding: encdstr = 'encoding="%s"' % encoding
|
||||||
|
else: encdstr = ''
|
||||||
|
writer.write('<?xml version="1.0" %s?>\n' % encdstr)
|
||||||
|
for node in self.childNodes:
|
||||||
|
node.writexml(writer, indent, addindent, newl)
|
Reference in New Issue
Block a user