Package net.sf.saxon.om

Examples of net.sf.saxon.om.NamePool


            }
        }
        level++;
        nextReceiver.startElement(nameCode, typeCode, locationId, properties);
        if (seekingHead) {
            NamePool namePool = getNamePool();
            int uriCode = namePool.getURICode(nameCode);
            String localName = namePool.getLocalName(nameCode);
            if (uriCode == requiredURICode && comparesEqual(localName, "head")) {
                foundHead = true;
            }
        }
View Full Code Here



    public void startContent() throws XPathException {
        if (foundHead) {
            foundHead = false;
            NamePool namePool = getNamePool();
            nextReceiver.startContent();
            int metaCode = namePool.allocate("", requiredURICode, "meta");
            nextReceiver.startElement(metaCode, StandardNames.XS_UNTYPED, 0, 0);
            int httpEquivCode = namePool.allocate("", "", "http-equiv");
            nextReceiver.attribute(httpEquivCode, StandardNames.XS_UNTYPED_ATOMIC, "Content-Type", 0, 0);
            int contentCode = namePool.allocate("", "", "content");
            nextReceiver.attribute(contentCode, StandardNames.XS_UNTYPED_ATOMIC, mediaType + "; charset=" + encoding, 0, 0);
            nextReceiver.startContent();
            droppingMetaTags = level;
            seekingHead = false;
            attributes = new AttributeCollectionImpl(namePool);
View Full Code Here

            NodeInfo node = (NodeInfo)item;
            switch (node.getNodeKind()) {
                case DOCUMENT:
                    return "document-node()";
                case ELEMENT:
                    NamePool pool = node.getNamePool();
                    int annotation = node.getTypeAnnotation();
                    return "element(" +
                            ((NodeInfo)item).getDisplayName() + ", " +
                            (annotation == -1 ?
                                "xs:untyped)" :
                                pool.getDisplayName(annotation) + ')');
                case ATTRIBUTE:
                    NamePool pool2 = node.getNamePool();
                    int annotation2 = node.getTypeAnnotation() & NamePool.FP_MASK;
                    return "attribute(" +
                            ((NodeInfo)item).getDisplayName()+ ", " +
                            (annotation2 == -1 ?
                                "xs:untypedAtomic)" :
                                pool2.getDisplayName(annotation2) + ')');
                case TEXT:      return "text()";
                case COMMENT:   return "comment()";
                case PROCESSING_INSTRUCTION:
                                return "processing-instruction()";
                case NAMESPACE: return "namespace()";
View Full Code Here

    private HashSet urlTable;

    private synchronized void buildURIAttributeTable() {
        // Reuse the attribute table for all XHTMLEmitters sharing the same namepool
        NamePool pool = getPipelineConfiguration().getConfiguration().getNamePool();
        urlTable = (HashSet)pool.getClientData(this.getClass());
        if (urlTable == null) {
            urlTable = new HashSet(40);
            pool.setClientData(this.getClass(), urlTable);
        }
        setUrlAttribute(pool, "form", "action");
        setUrlAttribute(pool, "object", "archive");
        setUrlAttribute(pool, "body", "background");
        setUrlAttribute(pool, "q", "cite");
View Full Code Here

     * @throws net.sf.saxon.trans.XPathException
     *
     */

    protected void openDocument() throws XPathException {
        NamePool pool = getPipelineConfiguration().getConfiguration().getNamePool();
        for (int i=0; i<emptyTagNames.length; i++) {
            emptyTags.add(pool.allocate("", NamespaceConstant.XHTML, emptyTagNames[i]) & NamePool.FP_MASK);
        }
        super.openDocument();
    }
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

     * @param seq sequence number of attribute, used for generating distinctive prefixes
     * @return the actual allocated name, which may be different.
    */

    private int checkProposedPrefix(int nameCode, int seq) throws XPathException {
        NamePool namePool = getNamePool();
        int nscode = namePool.getNamespaceCode(nameCode);
        if (nscode == -1) {
            // avoid calling allocate where possible, because it's synchronized
            nscode = namePool.allocateNamespaceCode(nameCode);
        }
        int nsprefix = nscode>>16;

        short existingURICode = getURICode((short)nsprefix);
        if (existingURICode == -1) {
            // prefix has not been declared: declare it now (namespace fixup)
            namespace(nscode, 0);
            return nameCode;
        } else {
            if ((nscode & 0xffff) == existingURICode) {
                // prefix is already bound to this URI
                return nameCode;  // all is well
            } else {
                // conflict: prefix is currently bound to a different URI
                String prefix = getSubstitutePrefix(nscode, seq);

                int newCode = namePool.allocate(
                                    prefix,
                                    namePool.getURI(nameCode),
                                    namePool.getLocalName(nameCode));
                namespace(namePool.allocateNamespaceCode(newCode), 0);
                return newCode;
            }
        }
    }
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

TOP

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

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.