Skip to content

Commit

Permalink
Adjust error DTD range for MSG_ATTRIBUTE_NOT_DECLARED (see #107)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelozerr committed Nov 13, 2018
1 parent 7c224cd commit 0b15ba1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,25 @@ public void MSG_CONTENT_INVALID() throws Exception {
"</note>";
XMLAssert.testDiagnosticsFor(xml, d(8, 1, 5, DTDErrorCode.MSG_CONTENT_INVALID));
}


@Test
public void MSG_ATTRIBUTE_NOT_DECLARED() throws Exception {
String xml = "<?xml version=\"1.0\"?>\r\n" + //
"<!DOCTYPE note [\r\n" + //
"<!ELEMENT note (to,from,heading,body)>\r\n" + //
"<!ELEMENT to (#PCDATA)>\r\n" + //
"<!ELEMENT from (#PCDATA)>\r\n" + //
"<!ELEMENT heading (#PCDATA)>\r\n" + //
"<!ELEMENT body (#PCDATA)>\r\n" + //
"]>\r\n" + //
"<note>\r\n" + //
" <to></to>\r\n" + //
" <from XXXX=\"\" >Jani</from>\r\n" + //
" <heading>Reminder</heading>\r\n" + //
" <body>Don't forget me this weekend</body>\r\n" + //
"</note> ";
XMLAssert.testDiagnosticsFor(xml, d(10, 10, 14, DTDErrorCode.MSG_ATTRIBUTE_NOT_DECLARED));
}
@Test
public void testDoctypeDiagnosticsRefresh() throws Exception {
//@formatter:off
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to></to>
<from XXXX="" >Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>

0 comments on commit 0b15ba1

Please sign in to comment.