24.08.2015 Views

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<strong>Author</strong> Developer Guide | 215if (startWithElementID) {// This the case when xpointer path starts with an element ID.String xpointerElement = xpointerPath[0];for (int i = 0; i < atts.length; i++) {if(xpointerElement.equals(atts[i].getValue())){if(idVerifier.hasIDType(localName, uri, atts[i].getQName(), atts[i].getNamespace())){xpointerPathDepth = startElementDepth + xpointerPath.length - 1;break;}}}}if (xpointerPathDepth == startElementDepth){// check if xpointer path matches with the current element pathlinkLocated = true;try {int xpointerIdx = xpointerPath.length - 1;int stackIdx = currentElementIndexStack.size() - 1;int stopIdx = startWithElementID ? 1 : 0;while (xpointerIdx >= stopIdx && stackIdx >= 0) {int xpointerIndex = Integer.parseInt(xpointerPath[xpointerIdx]);int currentElementIndex =((Integer)currentElementIndexStack.get(stackIdx)).intValue();if(xpointerIndex != currentElementIndex) {linkLocated = false;break;}}xpointerIdx--;stackIdx--;}} catch (NumberFormatException e) {logger.warn(e,e);}}return linkLocated;The method endElement will be invoked at the end of every element in the <strong>XML</strong> document (even when the elementis empty).The XPointerElementLocator implementation of the endElement updates the depth of the current elementpath and the index of the element in its parent.public void endElement(String uri, String localName, String name) {endElementDepth = startElementDepth;startElementDepth --;lastIndexInParent = ((Integer)currentElementIndexStack.pop()).intValue();}The IDElementLocator implementationThe IDElementLocator is an implementation of the abstract classro.sync.ecss.extensions.api.link.ElementLocator for links that use an id.The constructor only assigns field values and the method endElement is empty for this implementation.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!