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

Tim Allison commented on TIKA-4891:
-----------------------------------

Y, the idea of having to reinvent tagsoup was exactly what stopped me in my 
tracks last time I worked on this.

 

>From the :robot:
{noformat}
Nesting was worse than that one case. Scan of the 6180-file AUTO extracts: 1501 
files had a content-model violation. PowerPoint nests P in P (79k occurrences) 
and L in L (1145 files); Chrome and Acrobat leave whole pages as bare lines 
under Div with no paragraphs.
 {noformat}
And
{noformat}
That's a per-open-element validity check with a small dispatch table — closer 
to "write a strict pushdown validator over ~10 tags" than "reimplement an HTML 
parser." The nightmare version would be trying to handle all possible illegal 
PDF structures generically, or trying to preserve semantic fidelity for every 
producer's idiosyncratic misuse. The tractable version is: define your small 
legal grammar, and for every violation you actually observe in test corpora, 
add one rule to the dispatch table. It becomes finite because your output 
language is finite, even though the input (real-world PDFs) is infinite 
garbage. {noformat}

> Improve handling of PDF/UA structural tags/marked content
> ---------------------------------------------------------
>
>                 Key: TIKA-4891
>                 URL: https://issues.apache.org/jira/browse/TIKA-4891
>             Project: Tika
>          Issue Type: Task
>            Reporter: Tim Allison
>            Priority: Major
>         Attachments: 1008690.pdf, TIKA-4891-1008690.html, 
> image-2026-09-13-10-54-59-251.png, screenshot-1.png, screenshot-2.png
>
>
> PDF/UA includes structural markup. We hacked out a standalone handler for 
> this back in 1.x but haven't touched it in years.
>  
> We should modernize our handling of structural tags and eventually consider 
> turning that on by default. That decision will be based on evaluation on 
> 1000s of PDFs. This is not a default switch to be taken lightly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to