(self, writer, indent="", addindent="", newl="")
Write an XML element to a file-like object

        Write the element to the writer object that must provide
        a write method (e.g. a file or StringIO object).
Write an XML element to a file-like object
Write an XML element to a file - like object
def writexml(self, writer, indent="", addindent="", newl=""):
        """Write an XML element to a file-like object

        Write the element to the writer object that must provide
        a write method (e.g. a file or StringIO object).
        """
        # indent = current indentation
        # addindent = indentation to add to higher levels
        # newl = newline string
        writer.write(indent+"<" + self.tagName)

        attrs = self._get_attributes()

        for a_name in attrs.keys():
            writer.write(" %s=\"" % a_name)
            _write_data(writer, attrs[a_name].value)
            writer.write("\"")
        if self.childNodes:
            writer.write(">")
            if (len(self.childNodes) == 1 and
                self.childNodes[0].nodeType in (
                        Node.TEXT_NODE, Node.CDATA_SECTION_NODE)):
                self.childNodes[0].writexml(writer, '', '', '')
            else:
                writer.write(newl)
                for node in self.childNodes:
                    node.writexml(writer, indent+addindent, addindent, newl)
                writer.write(indent)
            writer.write("</%s>%s" % (self.tagName, newl))
        else:
            writer.write("/>%s"%(newl))
def writexml ( self , writer , indent = "" , addindent = "" , newl = "" ) : # indent = current indentation # addindent = indentation to add to higher levels # newl = newline string writer . write ( indent + "<" + self . tagName ) attrs = self . _get_attributes ( ) for a_name in attrs . keys ( ) : writer . write ( " %s=\"" % a_name ) _write_data ( writer , attrs [ a_name ] . value ) writer . write ( "\"" ) if self . childNodes : writer . write ( ">" ) if ( len ( self . childNodes ) == 1 and self . childNodes [ 0 ] . nodeType in ( Node . TEXT_NODE , Node . CDATA_SECTION_NODE ) ) : self . childNodes [ 0 ] . writexml ( writer , '' , '' , '' ) else : writer . write ( newl ) for node in self . childNodes : node . writexml ( writer , indent + addindent , addindent , newl ) writer . write ( indent ) writer . write ( "</%s>%s" % ( self . tagName , newl ) ) else : writer . write ( "/>%s" % ( newl ) )