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);
|
Assert.assertTrue(matches.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchNoMatches2() throws IOException {
|
public void testSearchNoMatches2() throws IOException {
|
||||||
|
|
|
@ -3716,11 +3716,21 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
Element div = text.getNamedChild("div");
|
Element div = text.getNamedChild("div");
|
||||||
if (lang != null && div != null) {
|
if (lang != null && div != null) {
|
||||||
XhtmlNode xhtml = div.getXhtml();
|
XhtmlNode xhtml = div.getXhtml();
|
||||||
String xl = xhtml.getAttribute("lang");
|
String l = xhtml.getAttribute("lang");
|
||||||
if (xl == null) {
|
String xl = xhtml.getAttribute("xml:lang");
|
||||||
warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language, but the XHTML does not have a language tag");
|
if (l == null && xl == null) {
|
||||||
} else if (!xl.equals(lang)) {
|
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)");
|
||||||
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 ");
|
} 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