Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7763121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:35:07+00:00 2026-06-01T14:35:07+00:00

I have ported Apache Tika to Android. I have a basic question. While working

  • 0

I have ported Apache Tika to Android. I have a basic question. While working on EPubParser, I am able to get the URI of the images in the EPub book. I have got the Text of the EPub book using BodyContentHandler and the image links using LinkContentHandler.

Now my problem is how can I show these images at the same place where they were in the source. Can anyone give me a pointer in this regard?

This is my code…

   InputStream myInputFileStream = getResources().openRawResource(R.raw.flashback);

    BodyContentHandler bodyHandler = new BodyContentHandler();

    LinkContentHandler linkHandler = new LinkContentHandler();

    TeeContentHandler handler = new TeeContentHandler(bodyHandler, linkHandler);

    EpubParser ePubParser = new EpubParser();

    Metadata metadata = new Metadata();
    try{

        ePubParser.parse(myInputFileStream, handler, metadata, new ParseContext());

    }

    catch(SAXException e){

    }
    catch(TikaException e){

    }

    catch(IOException e){

    }

    String plainText = bodyHandler.toString();

    List<Link> linkLists = linkHandler.getLinks();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:35:08+00:00Added an answer on June 1, 2026 at 2:35 pm

    Your best bet is probably to change how you’re doing it. Instead of getting the text and the links independently, get them all at the same time. To do this, fetch the text contents from Tika as XHTML rather than text, with something like:

        StringWriter sw = new StringWriter();
        SAXTransformerFactory factory = (SAXTransformerFactory)
                 SAXTransformerFactory.newInstance();
        TransformerHandler handler = factory.newTransformerHandler();
        handler.getTransformer().setOutputProperty(OutputKeys.METHOD, "xml");
        handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "no");
        handler.setResult(new StreamResult(sw));
    
        parser.parse(input, handler, metadata, new ParseContext());
    
        String xhtml = sw.toString();
    

    Once you have the XHTML, look through for links and images. When you find those, you’ll know exactly where things go in relation to the surrounding text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ported a Flash game over iPhone and the game is working very
I have a project being ported to work on Linux under Mono. The project
I have an AWT applet application that needs to be ported over to GWT.
I have an old C# program that is being ported to Python 3 for
I have posted a question about multilanguage database design here, [] What are best
I have posted question: how to use log4j in Multithread using java? . i
I have some basic questions with regards to portal framework - sorry if these
Hi I'm trying to use the maven android plugin and robolectric to get tests
This is a new understanding of a question I posted previously: I have a
I am looking to get started with SQL development and as such have decided

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.