All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.saxon.om.NamespaceDeclarationsImpl Maven / Gradle / Ivy

Go to download

Provides a basic XSLT 2.0 and XQuery 1.0 processor (W3C Recommendations, January 2007). Command line interfaces and implementations of several Java APIs (DOM, XPath, s9api) are also included.

The newest version!
package net.sf.saxon.om;

/**
 * An implementation of the NamespaceDeclarations interface,
 * based on encapsulating an array of namespace codes.
 */

public class NamespaceDeclarationsImpl implements NamespaceDeclarations {

    private NamePool namePool;
    private int[] namespaceCodes;
    private int used;

    private static final int[] emptyArray = new int[0];

    /**
     * Create an uninitialized instance
     */
 
    public NamespaceDeclarationsImpl() {}

    /**
     * Construct a set of namespace declarations
     * @param pool the name pool
     * @param codes an integer array holding the namespace codes. These
     * codes are allocated by the name pool, and can be used to look up
     * a prefix and uri in the name pool. If the array contains the integer
     * -1, this acts as a terminator for the list. This is the format
     * returned by the method {@link NodeInfo#getDeclaredNamespaces(int[])}.
     * A value of null is equivalent to supplying an empty array.
     */

    public NamespaceDeclarationsImpl(NamePool pool, int[] codes) {
        namePool = pool;
        setNamespaceCodes(codes);
    }

    /**
     * Set the name pool
     * @param pool the NamePool
     */

    public void setNamePool(NamePool pool) {
        namePool = pool;
    }

    /**
     * Set the namespace codes.
     * @param codes an integer array holding the namespace codes. These
     * codes are allocated by the name pool, and can be used to look up
     * a prefix and uri in the name pool. If the array contains the integer
     * -1, this acts as a terminator for the list. This is the format
     * returned by the method {@link NodeInfo#getDeclaredNamespaces(int[])}.
     * A value of null is equivalent to supplying an empty array.
     */

    public void setNamespaceCodes(int[] codes) {
        if (codes == null) {
            codes = emptyArray;
        }
        namespaceCodes = codes;
        used = codes.length;
        for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy