Editing and statement completion in XML files is made easier by using XSDs (XML Schema Definitions). This topic helps you configure IntelliJ to find and use these files.
In an XML file, you can use information from XSD files by including syntax like this:
In this example, the tableinfo.xsd
will be loaded and when editing your XML, you will have options like statement completion: if you enter a '<' character (to start an element), you will see a popup of valid options to assist you:
Configuring IntelliJ to Recognize XSDs
If you are not seeing XSDs registered and available as expected, check to ensure that your intelliJ is configured to find them in the correct location.
One symptom of an incorrect configuration is that the XML elements will be shown in intelliJ in red. Select the path value and click 'Alt-Enter'
for a menu of options. Choose Manually setup external resource
In the popup, find and double click the relevant xsd file, in this example, tableinfo.xsd. Click OK
. After you begin to edit your XML file, you will see the red alerts disappear and your XSD will be available.
You can also directly edit intelliJ's settings as follows:
- In IntelliJ, select File > Settings > Languages and Frameworks.
- Select Schemas and DTDs.
- In the top panel, you should see (or add) an entry for http://labkey.org/data/xml pointing to the tableinfo.xsd file in your enlistment.
- To edit an existing entry, click to select it and use the pencil icon to edit.
Learn more about how to manually setup external resources in IntelliJ here:
Common Namespace URIs
The following are some common LabKey XSD namespace URIs and their paths in the source tree.