use of io.mola.galimatias.Host in project validator by validator.
the class LanguageDetectingChecker method startDocument.
/**
* @see nu.validator.checker.Checker#startDocument()
*/
@Override
public void startDocument() throws SAXException {
httpContentLangHeader = "";
tld = "";
htmlStartTagLocator = null;
inBody = false;
currentOpenElementsInDifferentLang = 0;
currentOpenElementsWithSkipName = 0;
nonWhitespaceCharacterCount = 0;
elementContent = new StringBuilder();
documentContent = new StringBuilder();
htmlElementHasLang = false;
htmlElementLangAttrValue = "";
declaredLangCode = "";
hasDir = false;
dirAttrValue = "";
documentContent.setLength(0);
currentOpenElementsWithSkipName = 0;
try {
systemId = getDocumentLocator().getSystemId();
if (systemId != null && systemId.startsWith("http")) {
Host hostname = URL.parse(systemId).host();
if (hostname != null) {
String host = hostname.toString();
tld = host.substring(host.lastIndexOf(".") + 1);
}
}
} catch (GalimatiasParseException e) {
throw new RuntimeException(e);
}
}
Aggregations