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.

if(i > 0){try {Integer.parseInt(xpointerPath[i]);} catch (NumberFormatException e) {invalidFormat = true;}}<strong>Author</strong> Developer Guide | 214if(invalidFormat){throw new ElementLocatorException("Only the element() scheme is supported when locating XPointer links."}+ "Supported formats: element(elementID), element(/1/2/3),element(elemID/2/3/4).");}i++;}if(Character.isDigit(xpointerPath[0].charAt(0))){// This is the case when xpointer have the following pattern /1/5/7xpointerPathDepth = xpointerPath.length;} else {// This is the case when xpointer starts with an element IDxpointerPathDepth = -1;startWithElementID = true;}The method startElement will be invoked at the beginning of every element in the <strong>XML</strong> document(even when theelement is empty). The arguments it takes areuriThe namespace URI, or the empty string if the element has no namespace URI or ifnamespace processing is disabled.localNameqNameattsLocal name of the element.Qualified name of the element.Attributes attached to the element. If there are no attributes, this argument will be empty.The method returns true if the processed element is found to be the one indicated by the link.The XPointerElementLocator implementation of the startElement will update the depth of the currentelement and keep the index of the element in its parent. If the xpointerPath starts with an element ID then thecurrent element ID is verified to match the specified ID. If this is the case the depth of the XPointer is updated takinginto account the depth of the current element.If the XPointer path depth is the same as the current element depth then the kept indices of the current element path arecompared to the indices in the XPointer path. If all of them match then the element has been found.public boolean startElement(String uri, String localName,String name, Attr[] atts) {boolean linkLocated = false;// Increase current element document depthstartElementDepth ++;if (endElementDepth != startElementDepth) {// The current element is the first child of the parentcurrentElementIndexStack.push(new Integer(1));} else {// Another element in the parent elementcurrentElementIndexStack.push(new Integer(lastIndexInParent + 1));

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

Saved successfully!

Ooh no, something went wrong!