def getText(element, regEx=""):
    textNode = element.firstChild
    if textNode == None:
        raise SyntaxError("Empty element '%s'" % element.tagName)
    if textNode.nodeType != textNode.TEXT_NODE:
        raise SyntaxError("Non-text node: '%s'" % element.tagName)
    if not re.match(regEx, textNode.data):
        raise SyntaxError("Bad Text Value for '%s': '%s' " % (element.tagName, textNode.data))
    return str(textNode.data) #de-unicode it; this is needed for bsddb, for example

#Function for adding tabs to a string
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/tlslite/utils/xmltools.py/getText/original