Skip to content

Instantly share code, notes, and snippets.

@altitdb
Created June 23, 2015 15:23
Show Gist options
  • Save altitdb/775c987e58dcf858e7f2 to your computer and use it in GitHub Desktop.
Save altitdb/775c987e58dcf858e7f2 to your computer and use it in GitHub Desktop.
Implementação da validação de XML com XSD
private void OutputJaxpImplementationInfo() {
System.out.println(getJaxpImplementationInfo("DocumentBuilderFactory", DocumentBuilderFactory.newInstance().getClass()));
System.out.println(getJaxpImplementationInfo("XPathFactory", XPathFactory.newInstance().getClass()));
System.out.println(getJaxpImplementationInfo("TransformerFactory", TransformerFactory.newInstance().getClass()));
System.out.println(getJaxpImplementationInfo("SAXParserFactory", SAXParserFactory.newInstance().getClass()));
}
private String getJaxpImplementationInfo(String componentName, Class componentClass) {
CodeSource source = componentClass.getProtectionDomain().getCodeSource();
return MessageFormat.format(
"{0} implementation: {1} loaded from: {2}",
componentName,
componentClass.getName(),
source == null ? "Java Runtime" : source.getLocation());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment