Find XML Schema in Project
Answered
I noticed that IntelliJ automatically detect XML Schema files in the project and makes the target namespace known in other places. This mechanism would be really helpful for my plugin. Is there a way to tap into it and ask it if it knows a specific namespace and where the schema file is?
Please sign in to leave a comment.
Hi,
I'm not sure I understand what feature you mean. Could you please show an example on a screenshot or link to the IDEA web help feature description?
The function described here
https://www.jetbrains.com/help/idea/referencing-xml-schemas-and-dtds.html
Even works without schemaLocation when an xsd file for the namespace is somewhere in the project.
Please see
com.intellij.xml.XmlSchemaProvider
.Sadly
findSchema
always returnsnull
. AndgetAvailableProviders
returns an empty list.I will give more information what I am talking about. One of the imports in this picture is green. The others are red. That's because this one namespace is defined by the
model.xsd
file next to this file. But it doesn't matter where it is in the project. It sounds likefindSchema
should give me themodel.xsd
file when asked for its namespace. What else can I try?Any idea where I can look for this? The
XmlSchemaProvider
interface sounds right but it seems the only implementation has to do with JavaFX and has nothing to do with this feature.I found it. It's the function
findNSFilesByURI
inXmlUtil
.