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

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

This is the stream of start/end elements and calls to characters.  We get 
roughly the same mis-parsing if the closing tag is malformed or simply not 
there. TagSoup is emitting characters for what should be parsed as a tag.

You aren't seeing this misunderstanding in Tika because we don't pass on 
characters unless they're in the title or the body.

{noformat}
STARTING: HTML
STARTING: HEAD
STARTING: SCRIPT
CHARS: </
CHARS: scriptlanguage
CHARS: >
CHARS: 

CHARS: </
CHARS: head
CHARS: >
CHARS: 
<body>
<p>This is a test.
CHARS: </
CHARS: p
CHARS: >
CHARS: 

CHARS: </
CHARS: body
CHARS: >
CHARS: 

CHARS: </
CHARS: html
CHARS: >
end element: SCRIPT
end element: HEAD
end element: HTML
{noformat}

> 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