Get current document schema url

Post here questions and problems related to oXygen frameworks/document types.
cditcher
Posts: 29
Joined: Thu Jun 21, 2012 6:47 pm
Location: Victoria BC, Canada

Get current document schema url

Post by cditcher » Sat Jan 09, 2016 12:38 am

We are developing DTAs which have actions (implementations of ro.sync.ecss.extensions.api.AuthorOperation) that extend the functionality of Author. I have a situation where i need to get the url of the schema of the current document. I know this should be simple, but a search of the forums and api turned up no explicit example.

My first attempt was similar to this (where the variable 'aa' is an AuthorAccess implementation):

Code: Select all

aa.getUtilAccess().expandEditorVariables(EditorVariables.DETECTED_SCHEMA_URL, null);
Unfortunately, the String this returns was only ${dsu} instead of a valid path to a schema location.

Another attempt was:

Code: Select all

EditorVariables.expandEditorVariables(EditorVariables.DETECTED_SCHEMA_URL, aa.getDocumentController().getAuthorDocumentNode().getSystemID());
But still nothing.

The schema is valid, declared in the dta framework and validates the open document so Author is aware of the associated schema. Is there a better way?

Thanks,
Chris

alex_jitianu
Posts: 687
Joined: Wed Nov 16, 2005 11:11 am

Re: Get current document schema url

Post by alex_jitianu » Mon Jan 11, 2016 1:36 pm

Hello Chris,

It looks like EditorVariables.DETECTED_SCHEMA_URL variable only gets expanded inside a few, specific contexts. Please try:

Code: Select all

aa.getDocumentController().getAuthorSchemaManager().getGrammarURLs();
Best regards,
Alex

cditcher
Posts: 29
Joined: Thu Jun 21, 2012 6:47 pm
Location: Victoria BC, Canada

Re: Get current document schema url

Post by cditcher » Tue Jan 12, 2016 8:13 pm

Correct! Thanks Alex. I overlooked that.

Post Reply