Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-2404

XMLException in DOCX->TXT conversion

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Workaround
    • Affects Version/s: 1.15
    • Fix Version/s: 1.16
    • Component/s: parser
    • Labels:

      Description

      I got an XMLException when try to extract text from DOCX file (see attached file):

      Caused by: org.apache.tika.exception.TikaException: Unexpected RuntimeException from org.apache.tika.parser.microsoft.ooxml.OOXMLParser@1de6e9d6
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:282)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
      	... 16 more
      Caused by: org.apache.poi.POIXMLException: org.apache.xmlbeans.XmlException: Element hdr@http://schemas.openxmlformats.org/wordprocessingml/2006/main is not a valid ftr@http://schemas.openxmlformats.org/wordprocessingml/2006/main document or a valid substitution.
      	at org.apache.poi.xwpf.usermodel.XWPFFooter.onDocumentRead(XWPFFooter.java:121)
      	at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:196)
      	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:190)
      	at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:112)
      	at org.apache.poi.xwpf.extractor.XWPFWordExtractor.<init>(XWPFWordExtractor.java:58)
      	at org.apache.poi.extractor.ExtractorFactory.createExtractor(ExtractorFactory.java:232)
      	at org.apache.tika.parser.microsoft.ooxml.OOXMLExtractorFactory.parse(OOXMLExtractorFactory.java:104)
      	at org.apache.tika.parser.microsoft.ooxml.OOXMLParser.parse(OOXMLParser.java:106)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
      	... 23 more
      Caused by: org.apache.xmlbeans.XmlException: Element hdr@http://schemas.openxmlformats.org/wordprocessingml/2006/main is not a valid ftr@http://schemas.openxmlformats.org/wordprocessingml/2006/main document or a valid substitution.
      	at org.apache.xmlbeans.impl.store.Locale.autoTypeDocument(Locale.java:322)
      	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1384)
      	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1363)
      	at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:370)
      	at org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:144)
      	at org.openxmlformats.schemas.wordprocessingml.x2006.main.FtrDocument$Factory.parse(Unknown Source)
      	at org.apache.poi.xwpf.usermodel.XWPFFooter.onDocumentRead(XWPFFooter.java:96)
      

      If I use OpenOffice, the text can be get sucessfully.

        Attachments

        1. XmlException.docx
          33 kB
          Jorge Spinsanti

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Giorgy Jorge Spinsanti
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: