How do I provide XML Schema information to the XML Editor?

I would like to understand how I can associate an XML Schema (XSD file) with a particular XML document that I want to edit in IntelliJ in order to inform the editor how to provide XML element editing support.


If you have xmlns declaration in your document, invoke "Manually Setup
External Resource" quick fix on it.  It will be registered at Project
Settings -> Resources.


and if you have xml without namespace you need to declare xsi namespace and xsi:noNamespaceSchemaLocation pointing to actual schema location


Thank you.

In the following XML file the element name "module" is underlined in red in IntelliJ and the fly-over help says "attribute "noNamespaceSchemaLocation" from namespace "" not allowed at this point; ignored"

The editor is supporting the RelaxNG schema, so I am getting the benefit of the linkage. However, the red underline error report is troubling and I'd like to resolve it.


Thank you -- Randy

<module xmlns:xsi=""
        version="2.0" >
      <name>NK Portal Framework / Static</name>
      <description>NKPF / Static Resources</description>
    <!--Import and Share the NK Look and Feel-->


first this trick is not correct in the relax ng world. As i  know, relaxNG has no support for schemaLocation tip. Although something is works in idea for you, but this is not correct. Generally speaking, schemaLocation attribute is just a tip, optional for validation. To validate you need to match a concrete schema with concrete file. I know idea has a an item "Validate" in the right-click  menu. If you have no way to select desired schema there and can't register a concrete file(say using schema file path instead of uri) like Dmitry wrote, this a serious lack of xml functionality.
Feel free to fire a new issue for this, i'll vote for it once created.

As a workaround consider to switch to xsd (you can generate schema from your xml) or declare a namespace and register resource as Dmitry wrote.


On 21.01.2011 03:57, Randy Kahle wrote:

The editor is supporting the RelaxNG schema, no I am getting the benefit of the linkage. However, the red underline error report is troubling and I'd like to resolve it.

The xsi:* attributes are used by the XML Schema world and unless your RelaxNG schema explicitly
allows it, it is not considered valid.

The proper way to associate a RelaxNG schema with a document without namespace is to open the XML
document and then click on the inspection manager icon (the guy with the hat) in IDEA's status bar
and enter the schema location in the "RelaxNG Schema Association" field.




I have tried all sorts of combinations to get reliable schema-based XML editor support and I have come back to using XSD. I'm actually authoring the schemas in RelaxNG and then converting them to XSD. Fine so far.

I used your suggestion and did the fix-up and the editor now associates the file with the XSD document.

I have one remaining problems. When I do this the root element is marked in red and therefore the whole XML document is consider invalid. This does not occur when I use the direct binding to the physical XSD file location.

I would much prefer to use a logical reference for the XSD and map it through the resources.

Do you have any suggestions about how I can get rid of the red marker associated with the root element

Thank you!



Please sign in to leave a comment.