List of usage examples for org.w3c.dom Document getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:DOMWriter.java
/** Extracts the XML version from the Document. */ protected String getVersion(Document document) { if (document == null) { return null; }//from ww w. ja v a2s. co m String version = null; Method getXMLVersion = null; try { getXMLVersion = document.getClass().getMethod("getXmlVersion", new Class[] {}); // If Document class implements DOM L3, this method will exist. if (getXMLVersion != null) { version = (String) getXMLVersion.invoke(document, null); } } catch (Exception e) { // Either this locator object doesn't have // this method, or we're on an old JDK. } return version; }