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

Tilman Hausherr edited comment on TIKA-4891 at 9/13/26 3:56 PM:
----------------------------------------------------------------

This code has been removed which did the trim:
{code:java}
                int mcidInt = c.getMCID();
                MCID mcid = new MCID(pageRef, mcidInt);
                String p = sb.toString();
                if (c.getTag().equals("P")) {
                    p = p.trim();
                }
{code}
So we'd have to decide whether we want spaces before a closing tag or not. It 
looks as if Claude worked a bit like a "lazy programmer" (and yes that's also 
me sometimes) and added tests that fix the status quo and provide good test 
coverage, without thinking whether a result is what is wanted.

There's also a test that checks for "<p />" ?!


was (Author: tilman):
This code has been removed which did the trim:
{code:java}
                int mcidInt = c.getMCID();
                MCID mcid = new MCID(pageRef, mcidInt);
                String p = sb.toString();
                if (c.getTag().equals("P")) {
                    p = p.trim();
                }
{code}
So we'd have to decide whether we want spaces before a closing tag or not.

> 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, image-2026-09-13-10-54-59-251.png, 
> screenshot-1.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