Exemple #1
0
    def characters(self, data):

        if data:
            if isinstance(data, unicode):
                data = data.encode(self.encoding)

            self.out.write(escape(None, data))
Exemple #2
0
    def characters(self, data):

        if data:
            if isinstance(data, unicode):
                data = data.encode(self.encoding)

            self.out.write(escape(None, data))
Exemple #3
0
    def startElement(self, tag, attrs):

        self.out.write('<')
        self.out.write(tag)
        if attrs:
            for name, value in attrs.iteritems():
                if isinstance(value, unicode):
                    value = value.encode(self.encoding)
                self.out.write(' ')
                self.out.write(name)
                self.out.write('="')
                self.out.write(escape(None, value))
                self.out.write('"')
                
        self.out.write('>')
Exemple #4
0
    def startElement(self, tag, attrs):

        self.out.write('<')
        self.out.write(tag)
        if attrs:
            for name, value in attrs.iteritems():
                if isinstance(value, unicode):
                    value = value.encode(self.encoding)
                self.out.write(' ')
                self.out.write(name)
                self.out.write('="')
                self.out.write(escape(None, value))
                self.out.write('"')

        self.out.write('>')