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

Maruan Sahyoun edited comment on PDFBOX-5165 at 4/15/21, 8:15 PM:
------------------------------------------------------------------

[~tilman] could you try this code instead using Node.getNextSibling()

 
{code:java}
                Element bag = (Element) bagList.item(0);
                Node child = bag.getFirstChild();
                retval = new ArrayList<ResourceEvent>();
                while (child != null) {
                    if (child.getNodeType() == Node.ELEMENT_NODE)
                    {
                        Element el = (Element) child;
                        if (el.getTagName().equals("rdf:li"))
                        {
                            retval.add(new ResourceEvent(el));
                        }
                    }
                    child = child.getNextSibling();
                }
                retval = Collections.unmodifiableList(retval);
{code}

Brings it down to less than a second for me. Unfortunately I no longer have the 
env for PDFBox 1.8 so I'd first need to get everything installed to commit and 
test with the correct Java version..
 

 


was (Author: msahyoun):
[~tilman] could you try this code instead using Node.getNextSibling()

 
{code:java}
                Element bag = (Element) bagList.item(0);
                Node child = bag.getFirstChild();
                retval = new ArrayList<ResourceEvent>();
                while (child != null) {
                    if (child.getNodeType() == Node.ELEMENT_NODE)
                    {
                        Element el = (Element) child;
                        if (el.getTagName().equals("rdf:li"))
                        {
                            retval.add(new ResourceEvent(el));
                        }
                    }
                    child = child.getNextSibling();
                }
                retval = Collections.unmodifiableList(retval);
{code}

Brings it down to less than a second for me. Unfortunately I no longer have the 
env for PDFBox 1.8 so I'd first need to get enverything installed.
 

 

> Exceedingly slow processing of XMPSchemaMediaManagement's getHistory in 
> JempBox
> -------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5165
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5165
>             Project: PDFBox
>          Issue Type: Task
>          Components: JempBox
>    Affects Versions: 1.8.16
>            Reporter: Tim Allison
>            Priority: Trivial
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to