Extend the Java Functionality of an Existing Framework (Document Type)
Question
How can I change the way a DocBook 4 xref displays in
               Author mode based on what element is at the
               linkend?
            
Answer
- Create a Maven Java project and add a dependency on the Oxygen XML Author plugin
                     classes:<dependency> <groupId>com.oxygenxml</groupId> <artifactId>oxygen-sdk</artifactId> <version>${oxygen.version}</version> </dependency>where${oxygen.version}is the version of Oxygen XML Author plugin.Alternatively, if the project does not use Maven, all the transitive dependencies of the above Maven artifact need to be added to the classpath of the project. 
- Also add the [OXYGEN_INSTALL_DIR]\frameworks\docbook\docbook.jarto the class path of the project.
- Create a class that extends ro.sync.ecss.extensions.docbook.DocBook4ExtensionsBundleand overwrites the method:ro.sync.ecss.extensions.api.ExtensionsBundle#createLinkTextResolver()
- For your custom resolver implementation you can start from the Java sources of the
                     ro.sync.ecss.extensions.docbook.link.DocbookLinkTextResolver(the Java code for the entire DocBook customization is present in a subfolder in the oXygen SDK).
- Pack your extension classes in a JAR file. Copy the JAR to: [OXYGEN_INSTALL_DIR]\frameworks\docbook\custom.jar.
- Start Oxygen XML Author plugin.
- Open the Preferences dialog box and go to Document Type Association. Edit the DocBook 4 document type. In the Classpath list add the path to the new JAR. In the extensions list select your custom extension instead of the regular DocBook one.
- You can rename the document type and the docbookframework folder to something else (such ascustom_docbook) and share it with others.
