'Process an input string, inserting
<text:tab> elements for \'   \',
<text:line-break> elements for \'
\', and
<text:s> elements for runs of more than one blank.
These will be added to the given element.'

def addTextToElement(self, odfElement, s):

    i = 0
    ch = '    '
    while (i < len(s)):
        ch = s[i]
        if (ch == ' DCTB '):
            self._emitTextBuffer(odfElement)
            odfElement.addElement(Tab())
            i += 1
        elif (ch == '\n'):
            self._emitTextBuffer(odfElement)
            odfElement.addElement(LineBreak())
            i += 1
        elif (ch == '    '):
            self.textBuffer.append('    ')
            i += 1
            self.spaceCount = 0
            while ((i < len(s)) and (s[i] == '    ')):
                self.spaceCount += 1
                i += 1
            if (self.spaceCount > 0):
                self._emitTextBuffer(odfElement)
                self._emitSpaces(odfElement)
        else:
            self.textBuffer.append(ch)
            i += 1
    self._emitTextBuffer(odfElement)
