Speeding up xpath

后端 未结 6 638
广开言路
广开言路 2020-12-24 14:09

I have a 1000 entry document whose format is something like:


     
          
                   


        
6条回答
  •  不知归路
    2020-12-24 14:31

    The correct solution is to detach the node right after you call item(i), like so:

    Node node = results.item(index)
    node.getParentNode().removeChild(node)
    nodes.add(node)
    

    See XPath.evaluate performance slows down (absurdly) over multiple calls

提交回复
热议问题