tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewtr <andrew...@compvue.com>
Subject HTML styles and <li> tags are ignored
Date Mon, 04 Jun 2012 12:21:14 GMT
Hi:

While I am parsing the PDF or Word document using AutoDetectParser the <li>,
<ul> tags are converted as <p> tags. I need the exact HTML content what is
been there for PDF or Word Document.

I tried in several ways as below:

ToHTMLContentHandler textHandler = new ToHTMLContentHandler();
Metadata metadata = new Metadata();
Parser parser = new AutoDetectParser();
ParseContext context = new ParseContext();
context.set(HtmlMapper.class, new IdentityHtmlMapper());
parser.parse(in, textHandler, metadata, context);

---------------------------------------------------------

SAXTransformerFactory factory =
(SAXTransformerFactory)SAXTransformerFactory.newInstance();
TransformerHandler handler = factory.newTransformerHandler();
handler.getTransformer().setOutputProperty(OutputKeys.METHOD, "html");
handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "no");
handler.getTransformer().setOutputProperty(OutputKeys.ENCODING, "utf-8");
handler.setResult(new StreamResult(writer));
System.out.println(handler.toString());
return handler;

But the <li> tags are been replaced with <p> tags with class but the CSS
style is not seen in the parsed HTML output.

Any help is appreciated.

--
View this message in context: http://lucene.472066.n3.nabble.com/HTML-styles-and-li-tags-are-ignored-tp3987550.html
Sent from the Apache Tika - Development mailing list archive at Nabble.com.

Mime
View raw message