[ 
https://issues.apache.org/jira/browse/TIKA-1896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15216732#comment-15216732
 ] 

Tim Allison commented on TIKA-1896:
-----------------------------------

Thank you for raising this.

I'm not exceedingly familiar with TagSoup.  It looks from the snippet below of 
TagSoup's CommandLine, that the {{method=html}} parameter is being passed to 
the writer, not the parser.
{code}
                XMLWriter x;
...
                x = new XMLWriter(w);
...
                if (hasOption(options, "--method=")) {
                        String method = (String)options.get("--method=");
                        if (method != null) {
                                x.setOutputProperty(XMLWriter.METHOD, method);
                                }
                        }
{code}

Further, from the description of --method=html ("End-tags for the known empty 
HTML elements are suppressed."), it looks like this is accidentally fixing the 
problem you mention...if TagSoup is treating {{<script>}} as a known empty 
element???

Any fellow devs know how we might be able to fix this by changing the 
configuration on TagSoup's parser, perhaps?

> Invalid closing script tag not handled gracefully by HtmlParser
> ---------------------------------------------------------------
>
>                 Key: TIKA-1896
>                 URL: https://issues.apache.org/jira/browse/TIKA-1896
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.12
>            Reporter: Matthew Caruana Galizia
>         Attachments: test.html
>
>
> When an HTML file contains an invalid closing script tag, all content after 
> that tag is interpreted as script data and therefore ignored.
> Reduced test case file attached.
> To reproduce:
> 1) create a file with the following HTML
> {code:html}
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
> "http://www.w3.org/TR/html4/loose.dtd";>
> <html>
>       <head>
>               <script lang="javascript"></script language>
>       </head>
>       <body>
>               <p>This is a test.</p>
>       </body>
> </html>
> {code}
> 2) {{java -jar tika-app-1.12.jar -t test.html}}
> Expected result:
> {{This is a test.}}
> What is actually returned:
> Nothing.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to