test for existence of both lang and xml:lang on the xhtml div
This commit is contained in:
parent
4d99bcb0c6
commit
fccd3c1871
|
@ -71,7 +71,6 @@ public class PackageClientTests {
|
|||
}
|
||||
Assert.assertTrue(matches.size() > 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchNoMatches2() throws IOException {
|
||||
|
|
|
@ -3716,11 +3716,21 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
Element div = text.getNamedChild("div");
|
||||
if (lang != null && div != null) {
|
||||
XhtmlNode xhtml = div.getXhtml();
|
||||
String xl = xhtml.getAttribute("lang");
|
||||
if (xl == null) {
|
||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language, but the XHTML does not have a language tag");
|
||||
} else if (!xl.equals(lang)) {
|
||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language ("+lang+"), and the XHTML has a language ("+xl+"), but they differ ");
|
||||
String l = xhtml.getAttribute("lang");
|
||||
String xl = xhtml.getAttribute("xml:lang");
|
||||
if (l == null && xl == null) {
|
||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language, but the XHTML does not have an lang or an xml:lang tag (needs both - see https://www.w3.org/TR/i18n-html-tech-lang/#langvalues)");
|
||||
} else {
|
||||
if (l == null) {
|
||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language, but the XHTML does not have a lang tag (needs both lang and xml:lang - see https://www.w3.org/TR/i18n-html-tech-lang/#langvalues)");
|
||||
} else if (!l.equals(lang)) {
|
||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language ("+lang+"), and the XHTML has a lang ("+l+"), but they differ ");
|
||||
}
|
||||
if (xl == null) {
|
||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language, but the XHTML does not have an xml:lang tag (needs both lang and xml:lang - see https://www.w3.org/TR/i18n-html-tech-lang/#langvalues)");
|
||||
} else if (!xl.equals(lang)) {
|
||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language ("+lang+"), and the XHTML has an xml:lang ("+xl+"), but they differ ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue