Issue with custom ElementLocator
Posted: Tue Apr 23, 2024 7:13 pm
Hello,
Our xml documents use an xs:String for the ID instead of an xs:ID, where when we create a cross reference at a location, we generate that string (for the element we want to link to) and give that ID as an attribute to our cross-reference element.
I have not been able to get a custom Element Locator working such that it jumps to the linked location in the document. As a way around that, when I load the document (and when IDs are generated), I build a Map of all the nodes with an ID attribute where the ID is the key. The ElementLocatorProvider checks the selected link string with the IDs in the Map to find the node to jump and then moves the caret there.
The issue is that returning an ElementLocator seems to call an internal method that does one of two things: 1) if I return null instead of the ElementLocator, I jump to the position correctly, but I get a Bad Reference ID in the results window...OR 2) I return the elementLocator which does find the link, but stays at the top of the document.
Does anyone have a suggestion to solve this problem? I would get away from the ElementLocator altogether, but I haven't found another way to have Oxygen recognize a specific tag as a link with which I could jump locations.
Our xml documents use an xs:String for the ID instead of an xs:ID, where when we create a cross reference at a location, we generate that string (for the element we want to link to) and give that ID as an attribute to our cross-reference element.
I have not been able to get a custom Element Locator working such that it jumps to the linked location in the document. As a way around that, when I load the document (and when IDs are generated), I build a Map of all the nodes with an ID attribute where the ID is the key. The ElementLocatorProvider checks the selected link string with the IDs in the Map to find the node to jump and then moves the caret there.
The issue is that returning an ElementLocator seems to call an internal method that does one of two things: 1) if I return null instead of the ElementLocator, I jump to the position correctly, but I get a Bad Reference ID in the results window...OR 2) I return the elementLocator which does find the link, but stays at the top of the document.
Does anyone have a suggestion to solve this problem? I would get away from the ElementLocator altogether, but I haven't found another way to have Oxygen recognize a specific tag as a link with which I could jump locations.