You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Ken Krugler (JIRA)" <ji...@apache.org> on 2010/08/12 17:35:16 UTC
[jira] Created: (TIKA-478) HtmlParser can emit elements
inside of block
HtmlParser can emit <head> elements inside of <body> block
----------------------------------------------------------
Key: TIKA-478
URL: https://issues.apache.org/jira/browse/TIKA-478
Project: Tika
Issue Type: Bug
Components: parser
Affects Versions: 0.7
Reporter: Ken Krugler
Assignee: Ken Krugler
Priority: Critical
Fix For: 0.8
The change to fix [TIKA-379] causes a premature generation of HTML <head> element and nested <title> by the XHTMLContentHandler being used by HtmlHandler.
This then creates issues for any downstream content handler, as they can then get an empty <title> element, and <meta> elements inside of the <body> element (which is invalid).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TIKA-478) HtmlParser can emit elements
inside of block
Posted by "Ken Krugler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12897954#action_12897954 ]
Ken Krugler commented on TIKA-478:
----------------------------------
Emitting metadata entries inside of the <head> element works for <meta> elements, of course, but not for <link> or <base>. Though it does improve output for non-HTML parsers, so it feels like the right way to at least handle <meta>.
> HtmlParser can emit <head> elements inside of <body> block
> ----------------------------------------------------------
>
> Key: TIKA-478
> URL: https://issues.apache.org/jira/browse/TIKA-478
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.7
> Reporter: Ken Krugler
> Assignee: Ken Krugler
> Priority: Critical
> Fix For: 0.8
>
>
> The change to fix [TIKA-379] causes a premature generation of HTML <head> element and nested <title> by the XHTMLContentHandler being used by HtmlHandler.
> This then creates issues for any downstream content handler, as they can then get an empty <title> element, and <meta> elements inside of the <body> element (which is invalid).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TIKA-478) HtmlParser can emit elements
inside of block
Posted by "Ken Krugler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12897956#action_12897956 ]
Ken Krugler commented on TIKA-478:
----------------------------------
I ran into a test case failing when I applied my fix - looks like the epub parser calls XHTMLContentHandler with <head> elements, among others. This triggered the premature emitting of <title>. In order to guard against similar problems with other parsers, I modified XHTMLContentHandler to try to ignore startElement() calls with elements that would be auto-generated.
> HtmlParser can emit <head> elements inside of <body> block
> ----------------------------------------------------------
>
> Key: TIKA-478
> URL: https://issues.apache.org/jira/browse/TIKA-478
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.7
> Reporter: Ken Krugler
> Assignee: Ken Krugler
> Priority: Critical
> Fix For: 0.8
>
> Attachments: TIKA-478.patch
>
>
> The change to fix [TIKA-379] causes a premature generation of HTML <head> element and nested <title> by the XHTMLContentHandler being used by HtmlHandler.
> This then creates issues for any downstream content handler, as they can then get an empty <title> element, and <meta> elements inside of the <body> element (which is invalid).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (TIKA-478) HtmlParser can emit elements
inside of block
Posted by "Ken Krugler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ken Krugler updated TIKA-478:
-----------------------------
Attachment: TIKA-478-2.patch
Additional fix for problem with missing closing </body> and </html> tags.
> HtmlParser can emit <head> elements inside of <body> block
> ----------------------------------------------------------
>
> Key: TIKA-478
> URL: https://issues.apache.org/jira/browse/TIKA-478
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.7
> Reporter: Ken Krugler
> Assignee: Ken Krugler
> Priority: Critical
> Fix For: 0.8
>
> Attachments: TIKA-478-2.patch, TIKA-478.patch
>
>
> The change to fix [TIKA-379] causes a premature generation of HTML <head> element and nested <title> by the XHTMLContentHandler being used by HtmlHandler.
> This then creates issues for any downstream content handler, as they can then get an empty <title> element, and <meta> elements inside of the <body> element (which is invalid).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TIKA-478) HtmlParser can emit elements
inside of block
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12897811#action_12897811 ]
Jukka Zitting commented on TIKA-478:
------------------------------------
Oh, I see now where this problem with <meta/> elements is coming from.
One reasonably clean way to solve this would be to disable the output of <meta/> elements from HtmlHandler while keeping the code that sets the respective Metadata entries. Then in XHTMLContentHandler we'd modify the lazyStartDocument() method to output not just the <title/> element but the full set of collected metadata as <meta/> elements. We could also set the lang attribute (or xml:lang?) of the <html/> element if the respective Metadata entry is set.
The nice thing about this solution would be that the inclusion of metadata in <head/> would work also for other document types beyond HTML.
> HtmlParser can emit <head> elements inside of <body> block
> ----------------------------------------------------------
>
> Key: TIKA-478
> URL: https://issues.apache.org/jira/browse/TIKA-478
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.7
> Reporter: Ken Krugler
> Assignee: Ken Krugler
> Priority: Critical
> Fix For: 0.8
>
>
> The change to fix [TIKA-379] causes a premature generation of HTML <head> element and nested <title> by the XHTMLContentHandler being used by HtmlHandler.
> This then creates issues for any downstream content handler, as they can then get an empty <title> element, and <meta> elements inside of the <body> element (which is invalid).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (TIKA-478) HtmlParser can emit elements
inside of block
Posted by "Ken Krugler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ken Krugler updated TIKA-478:
-----------------------------
Attachment: TIKA-478.patch
> HtmlParser can emit <head> elements inside of <body> block
> ----------------------------------------------------------
>
> Key: TIKA-478
> URL: https://issues.apache.org/jira/browse/TIKA-478
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.7
> Reporter: Ken Krugler
> Assignee: Ken Krugler
> Priority: Critical
> Fix For: 0.8
>
> Attachments: TIKA-478.patch
>
>
> The change to fix [TIKA-379] causes a premature generation of HTML <head> element and nested <title> by the XHTMLContentHandler being used by HtmlHandler.
> This then creates issues for any downstream content handler, as they can then get an empty <title> element, and <meta> elements inside of the <body> element (which is invalid).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (TIKA-478) HtmlParser can emit elements
inside of block
Posted by "Ken Krugler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ken Krugler resolved TIKA-478.
------------------------------
Resolution: Fixed
SVN 984997.
Normally I'd let a patch like this bake for a while, but it's blocking some work that needs to use Tika trunk for other fixes, so I've pushed it out sooner than usual. Happy to revert if a review uncovers any issues.
> HtmlParser can emit <head> elements inside of <body> block
> ----------------------------------------------------------
>
> Key: TIKA-478
> URL: https://issues.apache.org/jira/browse/TIKA-478
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.7
> Reporter: Ken Krugler
> Assignee: Ken Krugler
> Priority: Critical
> Fix For: 0.8
>
> Attachments: TIKA-478.patch
>
>
> The change to fix [TIKA-379] causes a premature generation of HTML <head> element and nested <title> by the XHTMLContentHandler being used by HtmlHandler.
> This then creates issues for any downstream content handler, as they can then get an empty <title> element, and <meta> elements inside of the <body> element (which is invalid).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.