Enable validation and code completion for XML documents without schemaLocation #6245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NetBeans allows users to register DTDs and XSD to support code completion and validation for XML files referencing them.
For DTDs it is possible to register them either by their
public ID
or theirsystem ID
. For XSD only the registration based onsystem ID
was used. This in turn requires the document to be validated to carry axsi:schemaLocation
and/orxsi:noNamespaceSchemaLocation
attribute to link the XSD to the XML.That makes sense where the namespace itself is not an identifier. For example Jakarta EE 9 used one big namespace:
https://xmlns.jakarta.ee/jakartaee
, but multiple grammars (e.g. https://jakarta.ee/xml/ns/jakartaee/jakartaee_9.xsd and https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd). On the other hand there can be approaches where the namespace identifies the grammer uniquely. For these cases validation and code completion was enhanced to allow for this.In #6226 an example was provided, that looks like this:
each namespace uniquely identifies the grammar that defines it. There is no
schemaLocation
attribute, so the schemas need to be mapped:Then XML validation works:
And the editor can provide schema based completion: