Custom xml tag within Beans

Answered

I am in the process of writing a plugin for a simple custom xml tag within spring beans, as follows:

<beans>

  <example></example>

</beans>

I suppose I have to add an extension to my plugin which extends SpringCustomNamespaces, but I'm not sure how to implement the NamespacePolicy

Is there an example on the matter that you could refer me to, or point me to how I should approach this?

I only want to get the basics under way :)

1 comment
Comment actions Permalink

Unfortunately there is no open source example on how to use this.

Providing SpringCustomNamespaces is correct approach, NamespacePolicies is semantically same as com.intellij.util.xml.DomFileDescription#registerNamespacePolicy().

public class MyCustomNamespaces extends SpringCustomNamespaces {

  @Override
  public NamespacePolicies getNamespacePolicies() {
    return NamespacePolicies.simple(MY_NS_KEY,
                                    "http://your.uri.com";
  }

  @Override
  public void registerExtensions(DomExtensionsRegistrar registrar) {
    CustomNamespaceRegistrar.create(registrar, MY_NS_KEY)
      .add("example", ExampleDomClass.class)
      ...
  }


}
0

Please sign in to leave a comment.