org.w3c.dom.DOMImplementationSource Java Examples

The following examples show how to use org.w3c.dom.DOMImplementationSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DOMImplementationRegistry.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #2
Source File: DOMImplementationRegistry.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #3
Source File: DOMImplementationRegistry.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #4
Source File: DOMImplementationRegistry.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source = sources.get(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #5
Source File: DOMImplementationRegistry.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final List<DOMImplementation> implementations = new ArrayList<>();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source = sources.get(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.add(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return implementations.get(index);
                    } catch (IndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #6
Source File: DOMImplementationRegistry.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.add(s);
    }
}
 
Example #7
Source File: DOMImplementationRegistry.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #8
Source File: DOMImplementationRegistry.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #9
Source File: DOMImplementationRegistry.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #10
Source File: DOMImplementationRegistry.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #11
Source File: DOMImplementationRegistry.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #12
Source File: DOMImplementationRegistry.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #13
Source File: DOMImplementationRegistry.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #14
Source File: DOMImplementationRegistry.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #15
Source File: DOMImplementationRegistry.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #16
Source File: DOMImplementationRegistry.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #17
Source File: DOMImplementationRegistry.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #18
Source File: DOMImplementationRegistry.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #19
Source File: DOMImplementationRegistry.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #20
Source File: DOMImplementationRegistry.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #21
Source File: DOMImplementationRegistry.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #22
Source File: DOMImplementationRegistry.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #23
Source File: DOMImplementationRegistry.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #24
Source File: DOMImplementationRegistry.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #25
Source File: DOMImplementationRegistry.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #26
Source File: DOMImplementationRegistry.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register an implementation.
 *
 * @param s The source to be registered, may not be <code>null</code>
 */
public void addSource(final DOMImplementationSource s) {
    if (s == null) {
        throw new NullPointerException();
    }
    if (!sources.contains(s)) {
        sources.addElement(s);
    }
}
 
Example #27
Source File: DOMImplementationRegistry.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
Example #28
Source File: DOMImplementationRegistry.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #29
Source File: DOMImplementationRegistry.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Return the first implementation that has the desired
 * features, or <code>null</code> if none is found.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return An implementation that has the desired features,
 *         or <code>null</code> if none found.
 */
public DOMImplementation getDOMImplementation(final String features) {
    int size = sources.size();
    String name = null;
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementation impl = source.getDOMImplementation(features);
        if (impl != null) {
            return impl;
        }
    }
    return null;
}
 
Example #30
Source File: DOMImplementationRegistry.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}