1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xerces.internal.dom;
23
24 import java.util.ArrayList;
25 import java.util.List;
26 import java.util.StringTokenizer;
27 import org.w3c.dom.DOMImplementation;
28 import org.w3c.dom.DOMImplementationList;
29 import org.w3c.dom.DOMImplementationSource;
30
31 /**
32 * Supply one the right implementation, based upon requested features. Each
33 * implemented <code>DOMImplementationSource</code> object is listed in the
34 * binding-specific list of available sources so that its
35 * <code>DOMImplementation</code> objects are made available.
36 *
37 * <p>See also the
38 * <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMImplementationSource'>
39 * Document Object Model (DOM) Level 3 Core Specification</a>.
40 *
41 * @xerces.internal
42 *
43 */
44 public class DOMImplementationSourceImpl
45 implements DOMImplementationSource {
46
47 /**
48 * A method to request a DOM implementation.
49 * @param features A string that specifies which features are required.
50 * This is a space separated list in which each feature is specified
51 * by its name optionally followed by a space and a version number.
52 * This is something like: "XML 1.0 Traversal Events 2.0"
53 * @return An implementation that has the desired features, or
54 * <code>null</code> if this source has none.
55 */
56 public DOMImplementation getDOMImplementation(String features) {
57 // first check whether the CoreDOMImplementation would do
58 DOMImplementation impl =
59 CoreDOMImplementationImpl.getDOMImplementation();
60 if (testImpl(impl, features)) {
61 return impl;
62 }
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.dom;
22
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.StringTokenizer;
26 import org.w3c.dom.DOMImplementation;
27 import org.w3c.dom.DOMImplementationList;
28 import org.w3c.dom.DOMImplementationSource;
29
30 /**
31 * Supply one the right implementation, based upon requested features. Each
32 * implemented <code>DOMImplementationSource</code> object is listed in the
33 * binding-specific list of available sources so that its
34 * <code>DOMImplementation</code> objects are made available.
35 *
36 * <p>See also the
37 * <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMImplementationSource'>
38 * Document Object Model (DOM) Level 3 Core Specification</a>.
39 *
40 * @xerces.internal
41 *
42 * @LastModified: Oct 2017
43 */
44 public class DOMImplementationSourceImpl
45 implements DOMImplementationSource {
46
47 /**
48 * A method to request a DOM implementation.
49 * @param features A string that specifies which features are required.
50 * This is a space separated list in which each feature is specified
51 * by its name optionally followed by a space and a version number.
52 * This is something like: "XML 1.0 Traversal Events 2.0"
53 * @return An implementation that has the desired features, or
54 * <code>null</code> if this source has none.
55 */
56 public DOMImplementation getDOMImplementation(String features) {
57 // first check whether the CoreDOMImplementation would do
58 DOMImplementation impl =
59 CoreDOMImplementationImpl.getDOMImplementation();
60 if (testImpl(impl, features)) {
61 return impl;
62 }
|