Issue with custom ElementLocator
Having trouble installing Oxygen? Got a bug to report? Post it all here.
Issue with custom ElementLocator
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.
Re: Issue with custom ElementLocator
Hi,
So you have a custom XML document, with your own CSS used for visual editing.
I assume you have set the oxy-link property in your CSS:
https://www.oxygenxml.com/doc/ug-editor ... ments.html
something like:
And if that targetAttrName would be defined in your schema as having xs:ID type, things would work out of the box. But it is not.
So once you click that link in the Author visual editing mode, by default Oxygen calls a class named ro.sync.ecss.extensions.commons.DefaultElementLocatorProvider which creates a ro.sync.ecss.extensions.commons.IDElementLocator, you can find the source code for both classes here:
https://www.oxygenxml.com/maven/com/oxy ... ources.jar
But our default IDElementLocator (and you can look at its code) will recognize only xml:id's and attributes defined as IDs in the schemas.
So you implemented your own ro.sync.ecss.extensions.api.ExtensionsBundle.createElementLocatorProvider() which means your code should now be called instead. Maybe the implementations of our default locator provider that are in the jar linked above will help you further.
Regards,
Radu
So you have a custom XML document, with your own CSS used for visual editing.
I assume you have set the oxy-link property in your CSS:
https://www.oxygenxml.com/doc/ug-editor ... ments.html
something like:
Code: Select all
sourceElementName:before{
content: "CLICK ME";
-oxy-link: "#" attr(targetAttrName);
}
So once you click that link in the Author visual editing mode, by default Oxygen calls a class named ro.sync.ecss.extensions.commons.DefaultElementLocatorProvider which creates a ro.sync.ecss.extensions.commons.IDElementLocator, you can find the source code for both classes here:
https://www.oxygenxml.com/maven/com/oxy ... ources.jar
But our default IDElementLocator (and you can look at its code) will recognize only xml:id's and attributes defined as IDs in the schemas.
So you implemented your own ro.sync.ecss.extensions.api.ExtensionsBundle.createElementLocatorProvider() which means your code should now be called instead. Maybe the implementations of our default locator provider that are in the jar linked above will help you further.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service