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

Highlight error for bad xsd file in xsi:schemaLocation with the xsd file range #782

Closed
angelozerr opened this issue Jun 15, 2020 · 3 comments · Fixed by #799
Closed

Highlight error for bad xsd file in xsi:schemaLocation with the xsd file range #782

angelozerr opened this issue Jun 15, 2020 · 3 comments · Fixed by #799
Assignees
Labels
enhancement New feature or request validation XSD
Milestone

Comments

@angelozerr
Copy link
Contributor

angelozerr commented Jun 15, 2020

Given this XML :

<note xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	  xmlns="https://www.w3schools.com"
	  xsi:schemaLocation="https://www.w3schools.com XXXXXXXXX.xsd">
	<to></to>
	<from></from>
	<heading></heading>
	<body></body>
</note>

The XXXXXXXXX.xsd from xsi:schemaLocation="https://www.w3schools.com XXXXXXXXX.xsd" must be a highlighted as an error instead of the full attribute value.

Pay attention that xsi:schemaLocation can contain several xsd .

@datho7561 are you interested to work on that since you have fixed #666

@datho7561
Copy link
Contributor

I am interested on working on this.

@datho7561
Copy link
Contributor

I couldn't recreate the issue with the provided example. In order to get the error message to show up, I had to explicitly reference an element from the second schema, and the element had to be in a valid location.

note.xsd:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body">
        <xs:complexType>
          <xs:sequence>
            <xs:any minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>
<note:note xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:note="https://www.w3schools.com"
    xmlns:other="http://example.org/other" 
    xsi:schemaLocation="https://www.w3schools.com note.xsd http://example.org/other other.xsd">
  <note:to></note:to>
  <note:from></note:from>
  <note:heading></note:heading>
  <note:body>
    <other:content></other:content>
  </note:body>
</note:note>

@angelozerr
Copy link
Contributor Author

@datho7561 you are right my sample was bad, I updated it.

datho7561 added a commit to datho7561/lemminx that referenced this issue Jun 22, 2020
When non-existent schemas are referenced using `xs:schemaLocation`,
the location hint is now highlighted instead of the entire attribute
value.

Fixes eclipse#782

Signed-off-by: David Thompson <davthomp@redhat.com>
@angelozerr angelozerr added this to the 0.13.0 milestone Jun 23, 2020
@angelozerr angelozerr added enhancement New feature or request validation XSD labels Jun 23, 2020
datho7561 added a commit to datho7561/lemminx that referenced this issue Jun 23, 2020
When non-existent schemas are referenced using `xs:schemaLocation`,
the location hint is now highlighted instead of the entire attribute
value.

Fixes eclipse#782

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/lemminx that referenced this issue Jun 23, 2020
When non-existent schemas are referenced using `xs:schemaLocation`,
the location hint is now highlighted instead of the entire attribute
value.

Fixes eclipse#782

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/lemminx that referenced this issue Jun 23, 2020
When non-existent schemas are referenced using `xs:schemaLocation`,
the location hint is now highlighted instead of the entire attribute
value.

Fixes eclipse#782

Signed-off-by: David Thompson <davthomp@redhat.com>
angelozerr pushed a commit that referenced this issue Jun 23, 2020
When non-existent schemas are referenced using `xs:schemaLocation`,
the location hint is now highlighted instead of the entire attribute
value.

Fixes #782

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request validation XSD
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants