PsiReferenceProvider doesn't work with Well Formed XML files

Answered

I implemented PsiReferenceProvider to navigate across XML files, but it works only if there is no correct declaration (correct !DOCTYPE) , though MyPsiReferenceProvider is triggered when I open the XML file even when I press CTRL + B it triggers PsiReferenceBase implementation. It calls methods like multiResolve() and resolve()

MyXmlReference extends PsiReferenceBase<PsiElement> implements PsiPolyVariantReference

the correct XML declaration is known as "Well Formed" XML

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE business PUBLIC "//Kas//DTD Business Data/" "busienss.dtd">
<business>
<WORK .../>
</business>

Same if XML definition looks like this (doesn't work)

<?xml version='1.0' encoding='UTF-8'?>
<business>
<WORK .../>
</business>

But, if XML looks like this

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE business "busienss.dtd">
<business>

the implementation of PsiReferenceProvider works as it was with correct XML declaration but in this case, it displays Usages.

How to make it works properly without touching the XML declaration, or without DOCTYPE tag as in the second example?

2 comments
Comment actions Permalink

Please try registering your provider with com.intellij.psi.PsiReferenceRegistrar#HIGHER_PRIORITY

0
Comment actions Permalink

No, it doesn't help, I tried HIGHER_PRIORITY and even 1000.0, it doesn't work when XML has no well-formed declaration

0

Please sign in to leave a comment.