Plugin - Active DTD/Framework

Oxygen general issues.
patrick
Posts: 96
Joined: Mon May 09, 2011 11:54 am

Plugin - Active DTD/Framework

Post by patrick »

Hi,

I want to activate certain functions in a workspace plugin only if the current file is using a specific dtd (or a specific framework is activated). Can I get these information without parsing the content by myself?

Thanks,
Patrick
Radu
Posts: 9472
Joined: Fri Jul 09, 2004 5:18 pm

Re: Plugin - Active DTD/Framework

Post by Radu »

Hi Patrick,

Unfortunately we do not have some specific API for this. I will add an improvement request to add some because it looks like a valid use case.

In the meantime if the editor is opened in the visual Author mode you can look at the root node and possibly derive that information from there.

Or you can call the API:

ro.sync.exml.workspace.api.editor.WSEditorBase.createContentReader()

and use a SAX parser (ro.sync.exml.workspace.api.util.XMLUtilAccess.newNonValidatingXMLReader()) to parse the XML and obtain the information from there. You can stop the parsing after the root element was encountered by throwing an exception in the SAX content handler if you want fast detection.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9472
Joined: Fri Jul 09, 2004 5:18 pm

Re: Plugin - Active DTD/Framework

Post by Radu »

Hi Patrick,

In Oxygen 16.0 we added this API "ro.sync.exml.workspace.api.editor.WSEditorBase.getDocumentTypeInformation()" which gives you details about the document type configuration used for an opened XML document.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply