Dynamically registering schemas within a plugin

已回答

Hi,

I'm writing a plugin with support for XQuery. My plugin integrates with applications that can run XQuery files. Those applications can provide their own XML files with a given schema that they provide either as part of the installation, or as part of downloadable documentation they provide.

I would like to register/unregister these schema files dynamically whenever the user specifies the installation path, or has downloaded the documentation.

Is that possible? If so, what is the best approach to do this? I'm aware of `StandardResourceProvider`, but from what I understand that is only for static schemas known to the plugin when the plugin is initialized.

A related problem I am trying to solve is that in XSLT files, some vendors provide a mechanism for importing XQuery files into the XSLT, binding that namespace to the imported XQuery module. I can detect this programmatically, but don't know how to dynamically tell IntelliJ to ignore/unigore that namespace. Is this possible to do?

Kind regards,
Reece

0

You can manage registered resources programmatically from com.intellij.javaee.ExternalResourceManager

Default namespace bindings via com.intellij.psi.xml.XmlFileNSInfoProvider

1

Thanks. Using ExternalResourceManager works for registering/unregistering schema files.

0

Hi Reece Dunn

Can you share your project? I also created a plugin to support my custom schema but I can't find how to register the schema programmatically.

 

0

In most cases, using com.intellij.javaee.StandardResourceProvider extension point will be preferred.

0

请先登录再写评论。