in my Java program with Saxon 9-7, I need to find the element with an ID attribute (without prefix) set to a certain value. While there are slow XPath methods like "//*[@ID='" + refID + "']", or "id(...)" there is a selectID method on TreeInfo, that seems to be more efficient but it returns null.
I know, there must be a DTD that defines the attribute as being of type ID and the parser must be capable. However, without having a DTD, is it possible to get the element efficiently and how?
Thanks, Marc Dzaebel
Last edit: Marc Dzaebel 2016-06-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
See https://saxonica.plan.io/boards/3/topics/6460
Hi,
in my Java program with Saxon 9-7, I need to find the element with an ID attribute (without prefix) set to a certain value. While there are slow XPath methods like
"//*[@ID='" + refID + "']"
, or"id(...)"
there is a selectID method on TreeInfo, that seems to be more efficient but it returns null.Input:
<root> <node ID="1"/> </root>
Program:
nodeInfo.getTreeInfo().selectID("1", false);
// returns nullI know, there must be a DTD that defines the attribute as being of type ID and the parser must be capable. However, without having a DTD, is it possible to get the element efficiently and how?
Thanks, Marc Dzaebel
Last edit: Marc Dzaebel 2016-06-25
Please follow this discussion at https://saxonica.plan.io/boards/3/topics/6460