title: How do I find out which JAXP implementation is in use and where it was loaded from?
body: <p>I would like to provide diagnostic information about what JAXP implementation is in use, and which JAR file it was loaded from.</p>
  
  <p>One way to achieve this is to create in instance of, for example, a <code>DocumentBuilderFactory</code>, and then inspect the properties of that class:</p>
  
  <pre><code>private static String GetJaxpImplementation() {
      DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
      Class&lt;? extends DocumentBuilderFactory&gt; c = documentBuilderFactory.getClass();
      Package p = c.getPackage();
      CodeSource source = c.getProtectionDomain().getCodeSource();
      return MessageFormat.format(
              "Using JAXP implementation ''{0}'' ({1}) version {2} ({3}){4}",
              p.getName(),
              p.getImplementationVendor(),
              p.getSpecificationVersion(),
              p.getImplementationVersion(),
              source == null ? "." : " loaded from: " + source.getLocation());
  }
  </code></pre>
  
  <p>Is there a better way to achieve this, perhaps without having to create a <code>DocumentBuilderFactory</code>?</p>