jaxp/src/com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java
changeset 12458 d601e4bba306
parent 12457 c348e06f0e82
child 25264 040625ce9b72
equal deleted inserted replaced
12457:c348e06f0e82 12458:d601e4bba306
    19  */
    19  */
    20 package com.sun.org.apache.xerces.internal.dom;
    20 package com.sun.org.apache.xerces.internal.dom;
    21 
    21 
    22 import com.sun.org.apache.xerces.internal.impl.RevalidationHandler;
    22 import com.sun.org.apache.xerces.internal.impl.RevalidationHandler;
    23 import com.sun.org.apache.xerces.internal.parsers.DOMParserImpl;
    23 import com.sun.org.apache.xerces.internal.parsers.DOMParserImpl;
       
    24 import com.sun.org.apache.xerces.internal.parsers.DTDConfiguration;
       
    25 import com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration;
    24 import com.sun.org.apache.xerces.internal.util.XMLChar;
    26 import com.sun.org.apache.xerces.internal.util.XMLChar;
       
    27 import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
    25 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
    28 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
    26 import com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl;
    29 import com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl;
    27 import org.w3c.dom.DOMException;
    30 import org.w3c.dom.DOMException;
    28 import org.w3c.dom.DOMImplementation;
    31 import org.w3c.dom.DOMImplementation;
    29 import org.w3c.dom.Document;
    32 import org.w3c.dom.Document;
    47  * Core and Load/Save (Experimental). Optional modules are supported by
    50  * Core and Load/Save (Experimental). Optional modules are supported by
    48  * the more complete DOMImplementation class along with DocumentImpl.
    51  * the more complete DOMImplementation class along with DocumentImpl.
    49  *
    52  *
    50  * @xerces.internal
    53  * @xerces.internal
    51  *
    54  *
       
    55  * @version $Id: CoreDOMImplementationImpl.java,v 1.6 2010-11-01 04:39:37 joehw Exp $
    52  * @since PR-DOM-Level-1-19980818.
    56  * @since PR-DOM-Level-1-19980818.
    53  */
    57  */
    54 public class CoreDOMImplementationImpl
    58 public class CoreDOMImplementationImpl
    55         implements DOMImplementation, DOMImplementationLS {
    59         implements DOMImplementation, DOMImplementationLS {
    56         //
    60         //
   112             // plus, only features whose interfaces are directly castable are considered.
   116             // plus, only features whose interfaces are directly castable are considered.
   113             if ((feature.equalsIgnoreCase("+XPath"))
   117             if ((feature.equalsIgnoreCase("+XPath"))
   114                 && (anyVersion || version.equals("3.0"))) {
   118                 && (anyVersion || version.equals("3.0"))) {
   115                 try {
   119                 try {
   116                     Class xpathClass = ObjectFactory.findProviderClass(
   120                     Class xpathClass = ObjectFactory.findProviderClass(
   117                         "com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl",
   121                         "com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
   118                         ObjectFactory.findClassLoader(), true);
       
   119 
   122 
   120                 // Check if the DOM XPath implementation implements
   123                 // Check if the DOM XPath implementation implements
   121                 // the interface org.w3c.dom.XPathEvaluator
   124                 // the interface org.w3c.dom.XPathEvaluator
   122                 Class interfaces[] = xpathClass.getInterfaces();
   125                 Class interfaces[] = xpathClass.getInterfaces();
   123                 for (int i = 0; i < interfaces.length; i++) {
   126                 for (int i = 0; i < interfaces.length; i++) {
   279         public Object getFeature(String feature, String version) {
   282         public Object getFeature(String feature, String version) {
   280             if (singleton.hasFeature(feature, version)) {
   283             if (singleton.hasFeature(feature, version)) {
   281                 if ((feature.equalsIgnoreCase("+XPath"))) {
   284                 if ((feature.equalsIgnoreCase("+XPath"))) {
   282                     try {
   285                     try {
   283                         Class xpathClass = ObjectFactory.findProviderClass(
   286                         Class xpathClass = ObjectFactory.findProviderClass(
   284                             "com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl",
   287                             "com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
   285                             ObjectFactory.findClassLoader(), true);
       
   286 
       
   287                         // Check if the DOM XPath implementation implements
   288                         // Check if the DOM XPath implementation implements
   288                         // the interface org.w3c.dom.XPathEvaluator
   289                         // the interface org.w3c.dom.XPathEvaluator
   289                         Class interfaces[] = xpathClass.getInterfaces();
   290                         Class interfaces[] = xpathClass.getInterfaces();
   290                         for (int i = 0; i < interfaces.length; i++) {
   291                         for (int i = 0; i < interfaces.length; i++) {
   291                             if (interfaces[i].getName().equals(
   292                             if (interfaces[i].getName().equals(
   359                                         null);
   360                                         null);
   360                         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
   361                         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
   361                 }
   362                 }
   362                 if (schemaType != null
   363                 if (schemaType != null
   363                         && schemaType.equals("http://www.w3.org/TR/REC-xml")) {
   364                         && schemaType.equals("http://www.w3.org/TR/REC-xml")) {
   364                         return new DOMParserImpl(
   365                         return new DOMParserImpl(new DTDConfiguration(),
   365                                 "com.sun.org.apache.xerces.internal.parsers.DTDConfiguration",
       
   366                                 schemaType);
   366                                 schemaType);
   367                 }
   367                 }
   368                 else {
   368                 else {
   369                         // create default parser configuration validating against XMLSchemas
   369                         // create default parser configuration validating against XMLSchemas
   370                         return new DOMParserImpl(
   370                         return new DOMParserImpl(new XIncludeAwareParserConfiguration(),
   371                                 "com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration",
       
   372                                 schemaType);
   371                                 schemaType);
   373                 }
   372                 }
   374         }
   373         }
   375 
   374 
   376         /**
   375         /**