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

WordMLParser fails to parse a word xml file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.14
    • 1.15, 2.0.0
    • None
    • None
    • OSX, java 8

    Description

      Problem

      I have a sample word xml file (attached as File5.xml) that can be parsed by neither OOXMLParser (yields an exception that was Caused by: org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException: The supplied data appears to be a raw XML file. Formats such as Office 2003 XML are not supported) nor by OfficeParser (yields an exception like: org.apache.poi.poifs.filesystem.NotOLE2FileException: The supplied data appears to be a raw XML file. Formats such as Office 2003 XML are not supported

      I found TIKA-1958 which mentioned the new WordMLParser, so downloaded the source, built, and updated my tika version to 1.14. However, when parsing with WordMLParser, the output text content I get is the empty string "", but I'm expecting something more like:

      It means that the guy that you are trading with was reported for a scam attempt. As the others mentioned, some of these BOFA could be false.
      What's important is the current trade that you are doing.
      If everything seems to be in order then there is nothing wrong with going through with the trade.
      Auti, Sneha (QAPM)
      

      Replication

      You can replicate with the below Spock test

          def "display error with WordMLParser"(){
              setup:
              File input = new File("/Users/sstory/Downloads/File5.xml") //modify for your path
              Parser parser = new WordMLParser()
              //Parser parser = new OOXMLParser()
              //Parser parser = new OfficeParser()
              org.xml.sax.ContentHandler textHandler = new BodyContentHandler(-1)
              Metadata metadata = new Metadata()
              ParseContext context = new ParseContext()
              
              when:
              parser.parse(input.newInputStream(), textHandler, metadata, context)
              String result = textHandler.toString()
      
              then:
              !result.isEmpty()
              result.contains("the guy that you are trading with")
              result.contains("BOFA")
          }
      

      Attachments

        1. File5.xml
          48 kB
          Sean Story

        Issue Links

          Activity

            People

              tallison Tim Allison
              seanstory Sean Story
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: