Examples of NamePool


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

Examples of net.sf.saxon.om.NamePool


    public void startContent() throws XPathException {
        if (foundHead) {
            foundHead = false;
            NamePool namePool = getNamePool();
            nextReceiver.startContent();
            String uri = (requiredURICode == 0 ? "" : NamespaceConstant.XHTML);
            int metaCode = namePool.allocate("", uri, "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(getConfiguration());
View Full Code Here

Examples of net.sf.saxon.om.NamePool

    public void namespace(int namespaceCode, int properties) throws XPathException {
        if (namespaceCode == NamespaceConstant.XML_NAMESPACE_CODE) {
            return;
        }
        NamePool pool = pipe.getConfiguration().getNamePool();
        String prefix = pool.getPrefixFromNamespaceCode(namespaceCode);
        String uri = pool.getURIFromNamespaceCode(namespaceCode);
        if ((!undeclareNamespaces) && uri.length()==0 && !(prefix.length()==0)) {
            // This is a namespace undeclaration, but the ContentHandler doesn't want to know about undeclarations
            return;
        }
        try {
View Full Code Here

Examples of net.sf.saxon.om.NamePool

     * no attributes, no namespaces, and no content.
     */

    public void startContent() throws XPathException {
        try {
            NamePool namePool = pipe.getConfiguration().getNamePool();
            if (depth > 0 || !requireWellFormed) {
                String uri = namePool.getURI(pendingElement);
                String localName = namePool.getLocalName(pendingElement);
                String qname = namePool.getDisplayName(pendingElement);

                handler.startElement(uri,
                        localName,
                        qname,
                        pendingAttributes);
View Full Code Here

Examples of net.sf.saxon.om.NamePool

                    localName = parts[1];
                } catch (QNameException err) {
                    compileError("Element name " + s + " is not a valid QName", "XTSE0280");
                    return null;
                }
                NamePool target = getNamePool();
                int nameCode = target.allocate("", uri, localName);
                nt = new NameTest(Type.ELEMENT, nameCode, getNamePool());
                pat.setNodeTest(nt);
                stripperRules.addRule(
                            pat,
                            preserve,
View Full Code Here

Examples of net.sf.saxon.om.NamePool

                    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

Examples of net.sf.saxon.om.NamePool

     * 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

Examples of net.sf.saxon.om.NamePool

                        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

Examples of net.sf.saxon.om.NamePool

     *                   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

Examples of net.sf.saxon.om.NamePool

     * 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
Copyright © 2018 www.massapi.com. 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.