conditions to match reference provider

Hi all,  
I'm  stich at condition for mathcing reference provider.

I managed to match content of xml attribute  by name:


and now I'm trying to constrain this condition to  certain tag defined as dom elemement:


and (surprize!)  this does not work as intendet.   Is there some desrcription abot condition mathing?
( sources are bare of comments )

Comment actions Permalink

Something like this should work:

      .withSuperParent(2, DomPatterns.withDom(domElement(FooBar.class)

Comment actions Permalink

Hi Pribluda,

Could you post your sample XML, what you're trying to match, and what your DomElement interfaces look like? :)

Could it also be that your parent DomElement is actually a SuperParent for instance?

For example, here is an example of matching the XmlAttributeValue "value" if it has a super domElement parent of a BlueprintBean

Example of matched XML :

<bean id="foo" >
    <argument value="${}" />
    <property name="quux" value="${}" />

Example of the pattern used

                        .withSuperParent(3, withDom(domElement(BlueprintBean.class)))
Comment actions Permalink


   <link_in type="http" trigger="blamblam" receiver="StartMEssage"/>

And automagically generated interface:

public interface Link_in extends DomElement {

      * Returns the value of the receiver child.
      * @return the value of the receiver child.
     GenericAttributeValue<String> getReceiver();


So I like to reference to attribute value  of this tag defined by interface.  And while we are at it,  I'd like to navigate  to some other corresponding
tag ( so I shall return proper PSI element from my reference provicder?  right?  )  and provide error if no such tag  is found.   Is PsiReferenceContributor proper tool for this?

PS: My first name is Konstantin %)

Comment actions Permalink


Proper condition was:


Comment actions Permalink

Depending on your DOM and @Namespace definitions there, this might differ in the future when you change one place. I'd use DomPatterns if possible to make sure any changes in DOM are reflected here.

Comment actions Permalink

It did not worked with DomPatterns ,  despite declared namespace on generated interface.

Comment actions Permalink

Did you call com.intellij.util.xml.DomFileDescription#registerNamespacePolicy in your DomFileDescription?

Comment actions Permalink

Namespace policy is registered.     Shall I put key of namespace policy into @Namespace annotation or uri on interface?

Comment actions Permalink

@Namespace takes the key which is then registered in com.intellij.util.xml.DomFileDescription#registerNamespacePolicy with the corresponding URI(s).
See com.intellij.struts2.dom.struts.Struts2DomFileDescription and com.intellij.struts2.dom.struts.StrutsRoot as example.

Comment actions Permalink

OK,  not I'm slowly groking my problem.   You have to assure reachability of all the elements from root elelemt
with proper @Subag annotations  - otherwise DOM does not work properlyand does not know subtag classes.

Also,  need to check generated dom classes and adjust manually  


Please sign in to leave a comment.