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 | 2195. The method getReferenceUniqueID should return an unique identifier for the node reference. The uniqueidentifier is used to avoid resolving the references recursively. The method takes as argument an <strong>Author</strong>Node thatrepresents the node with the reference. In the implementation the unique identifier is the value of the location attributefrom the ref element.public String getDisplayName(<strong>Author</strong>Node node) {String displayName = "ref-fragment";if (node.getType() == <strong>Author</strong>Node.NODE_TYPE_ELEMENT) {<strong>Author</strong>Element element = (<strong>Author</strong>Element) node;if ("ref".equals(element.getLocalName())) {AttrValue attrValue = element.getAttribute("location");if (attrValue != null) {displayName = attrValue.getValue();}}}return displayName;}6. The method getReferenceSystemIDshould return the systemID of the referred content. It takes as argumentsan <strong>Author</strong>Node that represents the node with the reference and the <strong>Author</strong>Access with access methods to the<strong>Author</strong> data model. In the implementation you use the value of the location attribute from the ref element and resolveit relatively to the <strong>XML</strong> base URL of the node.public String getReferenceSystemID(<strong>Author</strong>Node node,<strong>Author</strong>Access authorAccess) {String systemID = null;if (node.getType() == <strong>Author</strong>Node.NODE_TYPE_ELEMENT) {<strong>Author</strong>Element element = (<strong>Author</strong>Element) node;if ("ref".equals(element.getLocalName())) {AttrValue attrValue = element.getAttribute("location");if (attrValue != null) {String attrStringVal = attrValue.getValue();try {URL absoluteUrl = new URL(node.get<strong>XML</strong>BaseURL(),authorAccess.correctURL(attrStringVal));systemID = absoluteUrl.toString();} catch (MalformedURLException e) {logger.error(e, e);}}}}return systemID;}Note: The complete source code can be found in the Simple Documentation Framework project, includedin the <strong>Oxygen</strong> <strong>Author</strong> SDK zip available for download on the <strong>Oxygen</strong> <strong>XML</strong> <strong>Author</strong> <strong>plugin</strong> website.In the listing below, the <strong>XML</strong> document contains the ref element:ReferenceWhen no reference resolver is specified, the reference has the following layout:Figure 107: Reference with no specified reference resolver

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

Saved successfully!

Ooh no, something went wrong!