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

Print this page




  84         //
  85         /** NON-DOM: Obtain and return the single shared object */
  86         public static DOMImplementation getDOMImplementation() {
  87                 return singleton;
  88         }
  89         //
  90         // DOMImplementation methods
  91         //
  92         /**
  93          * Test if the DOM implementation supports a specific "feature" --
  94          * currently meaning language and level thereof.
  95          *
  96          * @param feature The package name of the feature to test.
  97          * In Level 1, supported values are "HTML" and "XML" (case-insensitive).
  98          * At this writing, com.sun.org.apache.xerces.internal.dom supports only XML.
  99          *
 100          * @param version The version number of the feature being tested.
 101          * This is interpreted as "Version of the DOM API supported for the
 102          * specified Feature", and in Level 1 should be "1.0"
 103          *
 104          * @return true iff this implementation is compatable with the specified
 105          * feature and version.
 106          */
 107         public boolean hasFeature(String feature, String version) {
 108 
 109             boolean anyVersion = version == null || version.length() == 0;
 110 
 111             if (feature.startsWith("+")) {
 112                 feature = feature.substring(1);
 113             }
 114             return (
 115                 feature.equalsIgnoreCase("Core")
 116                     && (anyVersion
 117                         || version.equals("1.0")
 118                         || version.equals("2.0")
 119                         || version.equals("3.0")))
 120                         || (feature.equalsIgnoreCase("XML")
 121                     && (anyVersion
 122                         || version.equals("1.0")
 123                         || version.equals("2.0")
 124                         || version.equals("3.0")))
 125                         || (feature.equalsIgnoreCase("LS")
 126                     && (anyVersion || version.equals("3.0")));




 127         } // hasFeature(String,String):boolean
 128 
 129 
 130         /**
 131          * Introduced in DOM Level 2. <p>
 132          *
 133          * Creates an empty DocumentType node.
 134          *
 135          * @param qualifiedName The qualified name of the document type to be created.
 136          * @param publicID The document type public identifier.
 137          * @param systemID The document type system identifier.
 138          * @since WD-DOM-Level-2-19990923
 139          */
 140         public DocumentType createDocumentType( String qualifiedName,
 141                                     String publicID, String systemID) {
 142                 // REVISIT: this might allow creation of invalid name for DOCTYPE
 143                 //          xmlns prefix.
 144                 //          also there is no way for a user to turn off error checking.
 145                 checkQName(qualifiedName);
 146                 return new DocumentTypeImpl(null, qualifiedName, publicID, systemID);




  84         //
  85         /** NON-DOM: Obtain and return the single shared object */
  86         public static DOMImplementation getDOMImplementation() {
  87                 return singleton;
  88         }
  89         //
  90         // DOMImplementation methods
  91         //
  92         /**
  93          * Test if the DOM implementation supports a specific "feature" --
  94          * currently meaning language and level thereof.
  95          *
  96          * @param feature The package name of the feature to test.
  97          * In Level 1, supported values are "HTML" and "XML" (case-insensitive).
  98          * At this writing, com.sun.org.apache.xerces.internal.dom supports only XML.
  99          *
 100          * @param version The version number of the feature being tested.
 101          * This is interpreted as "Version of the DOM API supported for the
 102          * specified Feature", and in Level 1 should be "1.0"
 103          *
 104          * @return true if this implementation is compatible with the specified
 105          * feature and version.
 106          */
 107         public boolean hasFeature(String feature, String version) {
 108 
 109             boolean anyVersion = version == null || version.length() == 0;
 110 
 111             if (feature.startsWith("+")) {
 112                 feature = feature.substring(1);
 113             }
 114             return (feature.equalsIgnoreCase("Core") 

 115                         && (anyVersion 
 116                             || version.equals("1.0") 
 117                             || version.equals("2.0") 
 118                             || version.equals("3.0"))) 
 119                     || (feature.equalsIgnoreCase("XML")
 120                         && (anyVersion
 121                             || version.equals("1.0")
 122                             || version.equals("2.0")
 123                             || version.equals("3.0")))
 124                     || (feature.equalsIgnoreCase("LS")
 125                         && (anyVersion 
 126                             || version.equals("3.0")))
 127                     || (feature.equalsIgnoreCase("ElementTraversal")
 128                         && (anyVersion 
 129                             || version.equals("1.0")));
 130         } // hasFeature(String,String):boolean
 131 
 132 
 133         /**
 134          * Introduced in DOM Level 2. <p>
 135          *
 136          * Creates an empty DocumentType node.
 137          *
 138          * @param qualifiedName The qualified name of the document type to be created.
 139          * @param publicID The document type public identifier.
 140          * @param systemID The document type system identifier.
 141          * @since WD-DOM-Level-2-19990923
 142          */
 143         public DocumentType createDocumentType( String qualifiedName,
 144                                     String publicID, String systemID) {
 145                 // REVISIT: this might allow creation of invalid name for DOCTYPE
 146                 //          xmlns prefix.
 147                 //          also there is no way for a user to turn off error checking.
 148                 checkQName(qualifiedName);
 149                 return new DocumentTypeImpl(null, qualifiedName, publicID, systemID);