# HG changeset patch # User Reimar Bauer # Date 1201623486 -3600 # Node ID a438cc63c6269646b4aa5a31fcfce91559d9eb1d # Parent 4ec124c124c9acfba91ed433305795771c8199e1 converter.text_html_text_moin_wiki: bug fix for GuiEditorExcelPasteExpatErrorUnboundPrefix (thanks to Federico Lorenzi) diff -r 4ec124c124c9 -r a438cc63c626 MoinMoin/converter/text_html_text_moin_wiki.py --- a/MoinMoin/converter/text_html_text_moin_wiki.py Mon Jan 28 14:29:07 2008 +0100 +++ b/MoinMoin/converter/text_html_text_moin_wiki.py Tue Jan 29 17:18:06 2008 +0100 @@ -1306,7 +1306,25 @@ raise ConvertError('ExpatError: %s (see dump in %s)' % (msg, logname)) def convert(request, pagename, text): - text = u"%s" % text + # Due to expat needing explicitly set namespaces, we set these here to allow pasting + # from Word / Excel without issues. + # If you encounter 'ExpatError: unbound prefix', try adding the namespace to the list. + namespace = [u'xmlns:o="urn:schemas-microsoft-com:office:office"', + u'xmlns:x="urn:schemas-microsoft-com:office:excel"', + u'xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"', + u'xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"', + u'xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"', + u'xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"', + u'xmlns:rs="urn:schemas-microsoft-com:rowset"', + u'xmlns:z="#RowsetSchema"', + u'xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml"', + u'xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core"', + u'xmlns:aml="http://schemas.microsoft.com/aml/2001/core"', + u'xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"', + u'xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"', + u'xmlns:w10="urn:schemas-microsoft-com:office:word"', + u'xmlns:v="urn:schemas-microsoft-com:office:vml"'] + text = u'%s' % (' '.join(namespace), text) tree = parse(request, text) strip_whitespace().do(tree) text = convert_tree(request, pagename).do(tree)