Page 1 of 1

Get current document schema url

Posted: Sat Jan 09, 2016 12:38 am
by cditcher
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

Re: Get current document schema url

Posted: Mon Jan 11, 2016 1:36 pm
by alex_jitianu
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

Re: Get current document schema url

Posted: Tue Jan 12, 2016 8:13 pm
by cditcher
Correct! Thanks Alex. I overlooked that.