Package net.sf.saxon.om

Examples of net.sf.saxon.om.NamePool$NameEntry


                    localNamespaces[n+1] = -1;
                }
                return;
            }
            if ((nn & 0xffff0000) == (nscode & 0xffff0000)) {
                NamePool pool = pipe.getConfiguration().getNamePool();
                String prefix = pool.getPrefixFromNamespaceCode(nscode);
                String uri1 = pool.getURIFromNamespaceCode(nn);
                String uri2 = pool.getURIFromNamespaceCode(nscode);
                XPathException err = new XPathException(
                        "Cannot create two namespace nodes with the same prefix mapped to different URIs (prefix=" +
                        (prefix.length() == 0 ? "\"\"" : prefix) + ", URI=" +
                        (uri1.length() == 0 ? "\"\"" : uri1) + ", URI=" +
                        (uri2.length() == 0 ? "\"\"" : uri2) + ")");
View Full Code Here


     * attribute name, and that the prefixes of the element and each attribute are consistent with the declared
     * namespaces, changing any prefixes in the event of a conflict.
     */

    public void namespaceFixup() {
        NamePool pool = pipe.getConfiguration().getNamePool();
        nameCode = fixup(pool, nameCode, 0);
        if (attributes != null) {
            for (int a=0; a<attributes.size(); a++) {
                NodeInfo oldAtt = (NodeInfo)attributes.get(a);
                int oldCode = oldAtt.getNameCode();
View Full Code Here

                        state = REACHED_END_TAG;
                        break;
                    } else if (pe instanceof NodeInfo) {
                        int k = ((NodeInfo)pe).getNodeKind();
                        if (k == Type.NAMESPACE) {
                            NamePool pool = ((NodeInfo)pe).getNamePool();
                            int nscode = pool.allocateNamespaceCode(
                                    ((NodeInfo)pe).getLocalPart(), ((NodeInfo)pe).getStringValue());
                            start.addNamespace(nscode);
                            continue;
                        } else if (k == Type.ATTRIBUTE) {
                            start.addAttribute((NodeInfo)pe);
View Full Code Here

     *                   prefix is ""
     * @return the uri for the namespace, or null if the prefix is not in scope
     */

    public String getURIForPrefix(String prefix, boolean useDefault) {
        NamePool pool = getNamePool();
        if ((prefix==null || prefix.length()==0) && !useDefault) {
            return "";
        } else if ("xml".equals(prefix)) {
            return NamespaceConstant.XML;
        } else {
            short prefixCode = pool.getCodeForPrefix(prefix);
            short uriCode = getURICode(prefixCode);
            if (uriCode == -1) {
                return null;
            }
            return pool.getURIFromURICode(uriCode);
        }
    }
View Full Code Here

     * Get an iterator over all the prefixes declared in this namespace context. This will include
     * the default namespace (prefix="") and the XML namespace where appropriate
     */

    public Iterator iteratePrefixes() {
        NamePool pool = getNamePool();
        List prefixes = new ArrayList(namespacesSize);
        for (int i=namespacesSize-1; i>=0; i--) {
            String prefix = pool.getPrefixFromNamespaceCode(namespaces[i]);
            if (!prefixes.contains(prefix)) {
                prefixes.add(prefix);
            }
        }
        prefixes.add("xml");
View Full Code Here

            StaticQueryContext importedModule = loadModule(moduleURI, href);

            // Do the importing

            short ns = importedModule.getModuleNamespaceCode();
            NamePool pool = getTargetNamePool();
            Iterator it = importedModule.getFunctionDefinitions();
            while (it.hasNext()) {
                XQueryFunction def = (XQueryFunction)it.next();
                // don't import functions transitively
                if (pool.getURICode(def.getFunctionFingerprint()) == ns) {
                    top.declareXQueryFunction(def);
                }
                // Note, we are not importing global variables at present
            }
        } catch (XPathException err) {
View Full Code Here

  * Set the name pool to be used for all name codes
  */

  public void setConfiguration(Configuration config) {
        super.setConfiguration(config);
    NamePool namePool = config.getNamePool();
    nscodeXML = namePool.getNamespaceCode("xml", NamespaceConstant.XML);
    nscodeNull = namePool.getNamespaceCode("", "");
    super.setConfiguration(config);
  }
View Full Code Here

    public static Receiver getReceiver( Result result,
                                        Configuration config,
                                        Properties props,
                                        HashMap characterMapIndex)
                                    throws XPathException {
        NamePool namePool = config.getNamePool();
        if (result instanceof Emitter) {
            ((Emitter)result).setOutputProperties(props);
            return (Emitter)result;
        } else if (result instanceof Receiver) {
            return (Receiver)result;
        } else if (result instanceof SAXResult) {
            ContentHandlerProxy proxy = new ContentHandlerProxy();
            proxy.setUnderlyingContentHandler(((SAXResult)result).getHandler());
            proxy.setConfiguration(config);
            return proxy;
        } else if (result instanceof StreamResult) {

            // The "target" is the start of the output pipeline, the Receiver that
            // instructions will actually write to (except that other things like a
            // NamespaceReducer may get added in front of it). The "emitter" is the
            // last thing in the output pipeline, the Receiver that actually generates
            // characters or bytes that are written to the StreamResult.

            Receiver target;
            Emitter emitter;
            CharacterMapExpander characterMapExpander = null;
            String method = props.getProperty(OutputKeys.METHOD);

            String useMaps = props.getProperty(SaxonOutputKeys.USE_CHARACTER_MAPS);
            if (useMaps != null && characterMapIndex != null) {
                List characterMaps = new ArrayList(5);
                StringTokenizer st = new StringTokenizer(useMaps);
                while (st.hasMoreTokens()) {
                    String expandedName = st.nextToken();
                    int f = namePool.getFingerprintForExpandedName(expandedName);
                    HashMap map = (HashMap)characterMapIndex.get(new Integer(f));
                    if (map==null) {
                        throw new DynamicError("Character map '" + expandedName + "' has not been defined");
                    }
                    characterMaps.add(map);
View Full Code Here

        if (resultPrefix.equals("#default")) {
            resultPrefix="";
        }
        try {
            stylesheetURICode = getURICodeForPrefix(stylesheetPrefix);
            NamePool pool = getNamePool();
            resultNamespaceCode = pool.getNamespaceCode(
                                            resultPrefix,
                                            getURIForPrefix(resultPrefix, true));
            //getURICodeForPrefix(resultPrefix);
        } catch (NamespaceException err) {
            compileError(err.getMessage());
View Full Code Here

                if (precompiled) {
                    try {
                        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(styleFileName));
                        sheet = (PreparedStylesheet)ois.readObject();
                        ois.close();
                        NamePool compiledNamePool = sheet.getTargetNamePool();
                        sheet.setConfiguration(config);
                        sheet.getExecutable().setConfiguration(config);
                        config.setNamePool(compiledNamePool);
                        NamePool.setDefaultNamePool(compiledNamePool);
                        if (showTime) {
View Full Code Here

TOP

Related Classes of net.sf.saxon.om.NamePool$NameEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.