use of org.relaxng.datatype.DatatypeStreamingValidator in project validator by validator.
the class TextContentChecker method endElement.
/**
* @see nu.validator.checker.Checker#endElement(java.lang.String,
* java.lang.String, java.lang.String)
*/
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (inEmptyTitleOrOption && XHTML_URL.equals(uri) && "title".equals(localName)) {
err("Element \u201Ctitle\u201d must not be empty.");
inEmptyTitleOrOption = false;
} else if (inEmptyTitleOrOption && XHTML_URL.equals(uri) && "option".equals(localName) && !(parent != null && XHTML_URL.equals(parent[0]) && "datalist".equals(parent[1]))) {
err("Element \u201Coption\u201d without " + "attribute \u201clabel\u201d must not be empty.");
inEmptyTitleOrOption = false;
}
openElements.pop();
DatatypeStreamingValidator dsv = stack.removeLast();
if (dsv != null) {
try {
dsv.checkValid();
} catch (DatatypeException e) {
String msg = e.getMessage();
if (msg == null) {
err("The text content of element \u201C" + localName + "\u201D from namespace \u201C" + uri + "\u201D was not in the required format.");
} else {
if ("time".equals(localName)) {
try {
errBadTextContent(e, TimeDatetime.class, localName, uri);
} catch (ClassNotFoundException ce) {
}
} else if ("script".equals(localName)) {
try {
errBadTextContent(e, ScriptDocumentation.class, localName, uri);
} catch (ClassNotFoundException ce) {
}
} else {
err("The text content of element \u201C" + localName + // + "\u201D from namespace \u201C" + uri
"\u201D was not in the required format: " + msg.split(": ")[1]);
}
}
}
}
}
Aggregations