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 | 213The method getElementLocator determines what ElementLocator should be used. In the default implementationit checks if the link is an XPointer element() scheme otherwise it assumes it is an ID. A non-null IDTypeVerifierwill always be provided if a schema is associated with the document type.The link string argument is the "anchor" part of the of the URL which is composed from the value of the link propertyspecified for the link element in the CSS.public ElementLocator getElementLocator(IDTypeVerifier idVerifier,String link) {ElementLocator elementLocator = null;try {if(link.startsWith("element(")){// xpointer element() schemeelementLocator = new XPointerElementLocator(idVerifier, link);} else {// Locate link element by IDelementLocator = new IDElementLocator(idVerifier, link);}} catch (ElementLocatorException e) {logger.warn("Exception when create element locator for link: "+ link + ". Cause: " + e, e);}return elementLocator;}The XPointerElementLocator implementationXPointerElementLocator is an implementation of the abstract classro.sync.ecss.extensions.api.link.ElementLocator for links that have one of the following XPointerelement() scheme patterns:element(elementID)Locate the element with the specified id.element(/1/2/3)element(elementID/3/4)A child sequence appearing alone identifies an element by means of stepwisenavigation, which is directed by a sequence of integers separated by slashes (/); eachinteger n locates the nth child element of the previously located element.A child sequence appearing after a NCName identifies an element by means of stepwisenavigation, starting from the element located by the given name.The constructor separates the id/integers which are delimited by slashes(/) into a sequence of identifiers (an XPointerpath). It will also check that the link has one of the supported patterns of the XPointer element() scheme.public XPointerElementLocator(IDTypeVerifier idVerifier, String link)throws ElementLocatorException {super(link);this.idVerifier = idVerifier;link = link.substring("element(".length(), link.length() - 1);StringTokenizer stringTokenizer = new StringTokenizer(link, "/", false);xpointerPath = new String[stringTokenizer.countTokens()];int i = 0;while (stringTokenizer.hasMoreTokens()) {xpointerPath[i] = stringTokenizer.nextToken();boolean invalidFormat = false;// Empty xpointer component is not supportedif(xpointerPath[i].length() == 0){invalidFormat = true;}

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

Saved successfully!

Ooh no, something went wrong!