def unquotefromdtd(source): """unquotes a quoted dtd definition""" # extract the string, get rid of quoting if len(source) == 0: source = '""' # The quote characters should be the first and last characters in the # string. Of course there could also be quote characters within the string. quotechar = source[0] extracted, quotefinished = quote.extractwithoutquotes(source, quotechar, quotechar, allowreentry=False) extracted = extracted.decode('utf-8') if quotechar == "'": extracted = extracted.replace("'", "'") extracted = quote.entitydecode(extracted, _DTD_NAME2CODEPOINT) return extracted
def unquotefromdtd(source): """unquotes a quoted dtd definition""" # extract the string, get rid of quoting if len(source) == 0: source = '""' # The quote characters should be the first and last characters in the # string. Of course there could also be quote characters within the string. quotechar = source[0] extracted, quotefinished = quote.extractwithoutquotes(source, quotechar, quotechar, allowreentry=False) if quotechar == "'": extracted = extracted.replace("'", "'") return quote.entitydecode(extracted, _DTD_NAME2CODEPOINT)