Code example for DOMSource

Methods: getNode

0
    } 
 
    private static Node tryExtractNodeFromDOMSource(Source s) {
        if (s instanceof DOMSource) {
            @SuppressWarnings("unchecked") DOMSource ds = (DOMSource) s;
            return ds.getNode();
        } 
        return null; 
    } 
 
    /** 
     * Creates a JAXP NamespaceContext from a Map prefix => Namespace URI. 
     */ 
    public static NamespaceContext
        toNamespaceContext(Map<String, String> prefix2URI) {
        final Map<String, String> copy =
            new LinkedHashMap<String, String>(prefix2URI);
        return new NamespaceContext() {
            public String getNamespaceURI(String prefix) {
                if (prefix == null) {
                    throw new IllegalArgumentException("prefix must not be null");