Hi Denis,
I'm afraid I do not quite understand.
So a DITA topic has a DOCTYPE like this:
Code: Select all
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
First Oxygen will try to resolve the Public ID
"-//OASIS//DTD DITA Topic//EN" to a local DTD using its XML catalog support.
Each document type association in the Preferences
Document Type Association page provides a set of catalogs. All these catalogs are gathered together and Oxygen searches in them in the order in which they are contributed by the document type associations.
There is also an
XML / XML Catalog page. All catalogs referenced there will be considered high priority and will be used to resolve the public ID first.
If Oxygen does not find a mapping for the public ID, it will try to map the system ID (in our case
topic.dtd) through the XML catalogs to a local DTD, using the same approach.
If this also fails, Oxygen will consider the system ID as a local relative reference and try to open it relative to the XML document.
In order to provide your own prioritary XML catalog mappings:
1) You could force set the list of XML catalogs using the API:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("catalogs.v5", new String[]{
"${workspace}/REPOSITORY/system/catalog.xml"
});
If you use a custom editor variable in the URL, you can register a custom editor variables resolver:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().getUtilAccess().addCustomEditorVariablesResolver(new EditorVariablesResolver() {
/**
* @see ro.sync.exml.workspace.api.util.EditorVariablesResolver#resolveEditorVariables(java.lang.String, java.lang.String)
*/
@Override
public String resolveEditorVariables(String contentWithEditorVariables,
String currentEditedFileURL) {
return contentWithEditorVariables.replace("${workspace}", "realLocation");
}
});
You just need to make sure that the final location to which the catalog will be resolved is in URL syntax (like: file:/C:/.../catalog.xml).
2) Or you can use the API:
Code: Select all
ro.sync.exml.workspace.api.PluginWorkspace.importGlobalOptions(File)
to force import an options XML file in the global options.
3) Or you could set up a custom priority entity resolver which could for example try to delegate to your own custom catalog resolver:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().getXMLUtilAccess().addPriorityEntityResolver(new EntityResolver() {
org.apache.xml.resolver.CatalogManager catalogManager = new CatalogManager();
{
catalogManager.setCatalogFiles("file:/c:/a../catalog.xml");
}
CatalogResolver resolver = new CatalogResolver(catalogManager);
@Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException,
IOException {
return resolver.resolveEntity(publicId, systemId);
}
});
Regards,
Radu