src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java

Print this page

        

*** 106,141 **** */ public boolean hasFeature(String feature, String version) { boolean anyVersion = version == null || version.length() == 0; - // check if Xalan implementation is around and if yes report true for supporting - // XPath API - // if a plus sign "+" is prepended to any feature name, implementations - // are considered in which the specified feature may not be directly - // castable DOMImplementation.getFeature(feature, version). Without a - // plus, only features whose interfaces are directly castable are considered. - if ((feature.equalsIgnoreCase("+XPath")) - && (anyVersion || version.equals("3.0"))) { - try { - Class xpathClass = ObjectFactory.findProviderClass( - "com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true); - - // Check if the DOM XPath implementation implements - // the interface org.w3c.dom.XPathEvaluator - Class interfaces[] = xpathClass.getInterfaces(); - for (int i = 0; i < interfaces.length; i++) { - if (interfaces[i].getName().equals( - "org.w3c.dom.xpath.XPathEvaluator")) { - return true; - } - } - } catch (Exception e) { - return false; - } - return true; - } if (feature.startsWith("+")) { feature = feature.substring(1); } return ( feature.equalsIgnoreCase("Core") --- 106,115 ----
*** 279,308 **** /** * DOM Level 3 WD - Experimental. */ public Object getFeature(String feature, String version) { if (singleton.hasFeature(feature, version)) { - if ((feature.equalsIgnoreCase("+XPath"))) { - try { - Class xpathClass = ObjectFactory.findProviderClass( - "com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true); - // Check if the DOM XPath implementation implements - // the interface org.w3c.dom.XPathEvaluator - Class interfaces[] = xpathClass.getInterfaces(); - for (int i = 0; i < interfaces.length; i++) { - if (interfaces[i].getName().equals( - "org.w3c.dom.xpath.XPathEvaluator")) { - return xpathClass.newInstance(); - } - } - } catch (Exception e) { - return null; - } - } else { return singleton; } - } return null; } // DOM L3 LS --- 253,264 ----