Skip to content

Commit

Permalink
Fixes error range for cvc2.4.f
Browse files Browse the repository at this point in the history
Fixes #368

Signed-off-by: David Kwon <[email protected]>
  • Loading branch information
dkwon17 authored and fbricon committed May 21, 2019
1 parent 589c17c commit fa2c051
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public enum XMLSchemaErrorCode implements IXMLErrorCode {
cvc_complex_type_2_4_b("cvc-complex-type.2.4.b"), // https://wiki.xmldation.com/Support/Validator/cvc-complex-type-2-4-b
cvc_complex_type_2_4_c("cvc-complex-type.2.4.c"), // https://wiki.xmldation.com/Support/Validator/cvc-complex-type-2-4-c
cvc_complex_type_2_4_d("cvc-complex-type.2.4.d"), // https://wiki.xmldation.com/Support/Validator/cvc-complex-type-2-4-d
cvc_complex_type_2_4_f("cvc-complex-type.2.4.f"), // https://wiki.xmldation.com/Support/Validator/cvc-complex-type-2-4-f
cvc_complex_type_3_1("cvc-complex-type.3.1"), // https://wiki.xmldation.com/Support/Validator/cvc-complex-type-3-1
cvc_complex_type_3_2_2("cvc-complex-type.3.2.2"), // https://wiki.xmldation.com/Support/Validator/cvc-complex-type-3-2-2
cvc_complex_type_4("cvc-complex-type.4"), // https://wiki.xmldation.com/Support/Validator/cvc-complex-type-4
Expand Down Expand Up @@ -126,6 +127,7 @@ public static Range toLSPRange(XMLLocator location, XMLSchemaErrorCode code, Obj
case cvc_complex_type_2_4_b:
case cvc_complex_type_2_4_c:
case cvc_complex_type_2_4_d:
case cvc_complex_type_2_4_f:
case cvc_elt_1_a:
case cvc_complex_type_4:
case TargetNamespace_2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ public void cvc_complex_type_2_4_d() throws Exception {
testDiagnosticsFor(xml, d(4, 4, 4, 8, XMLSchemaErrorCode.cvc_complex_type_2_4_d));
}

@Test
public void cvc_complex_type_2_4_f() throws Exception {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n" + //
"<root\r\n" + //
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n" + //
" xsi:noNamespaceSchemaLocation=\"src/test/resources/xsd/sequence.xsd\">\r\n" + //
" <tag></tag>\r\n" + //
" <optional></optional>\r\n" + //
" <optional></optional>\r\n" + //
" <optional></optional>\r\n" + //
"</root>";
testDiagnosticsFor(xml, d(7, 3, 7, 11, XMLSchemaErrorCode.cvc_complex_type_2_4_f));
}

@Test
public void cvc_type_3_1_1() throws Exception {
String xml = "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n" + //
Expand Down
16 changes: 16 additions & 0 deletions org.eclipse.lsp4xml/src/test/resources/xsd/sequence.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="tag"/>
<xs:element
name="optional"
minOccurs="0"
maxOccurs="2"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

0 comments on commit fa2c051

Please sign in to comment.