Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML validation should aggregate XSD errors where is referenced #768

Closed
datho7561 opened this issue Jun 8, 2020 · 1 comment · Fixed by #916
Closed

XML validation should aggregate XSD errors where is referenced #768

datho7561 opened this issue Jun 8, 2020 · 1 comment · Fixed by #916
Assignees
Labels
bug Something isn't working validation
Milestone

Comments

@datho7561
Copy link
Contributor

The error range for EmptyTargetNamespace for an .xml file that references an .xsd file with an empty target namespace is incorrect. Here is the current error range, with the warning label placed on the model of <?xml-model...:

EmptyTargetNamespaceXML

To reproduce, the xmlns attribute of the root element needs to be set to a non-empty value.

Here is some sample code to reproduce:

twoLetterName.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="">
    <xs:element name="two-letter-name">
        <xs:simpleType>
            <xs:restriction base="xs:token">
                <xs:pattern value="[A-Z][a-z]"></xs:pattern>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
</xs:schema>

twoLetterNameInstance.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model
    href="twoLetterName.xsd"
    type="application/xml"
    schematypens="http://www.w3.org/2001/XMLSchema"?>
<two-letter-name xmlns="otherNamespace">Io</two-letter-name>

The range should instead highlight the reference to the .xsd schema file. This is because the schema file is what is causing this issue. For instance, in this case, href="twoLetterName.xsd" should be highlighted.

@angelozerr angelozerr added bug Something isn't working validation labels Jun 10, 2020
@angelozerr angelozerr changed the title Incorrect error range for EmptyTargetNamespace XML validation should aggregate XSD errors where is referenced Oct 13, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 13, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 13, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 15, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 20, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 20, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 21, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 21, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 22, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
angelozerr added a commit to angelozerr/lemminx that referenced this issue Oct 23, 2020
datho7561 pushed a commit that referenced this issue Oct 23, 2020
Fixes #768

Signed-off-by: azerr <azerr@redhat.com>
@angelozerr
Copy link
Contributor

Thanks so much @datho7561 for your great review!

@angelozerr angelozerr added this to the 0.14.0 milestone Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants