Package net.sf.saxon.om

Examples of net.sf.saxon.om.NamePool


            if (context == null) {
                // no name pool available
                message = "Supplied value of type " + Type.displayTypeName(item) +
                        " does not match the required type of " + role.getMessage();
            } else {
                final NamePool pool = context.getNamePool();
                final TypeHierarchy th = context.getConfiguration().getTypeHierarchy();
                message = role.composeErrorMessage(requiredItemType, Value.asValue(item).getItemType(th), pool);
            }
            String errorCode = role.getErrorCode();
            if ("XPDY0050".equals(errorCode)) {
View Full Code Here


            return this;
        }
        if (namespaceCodes == null || namespaceCodes.length == 0) {
            return this;
        }
        NamePool pool = visitor.getExecutable().getConfiguration().getNamePool();
        int uriCode = getURICode(pool);
        if (content instanceof FixedElement) {
            if (((FixedElement)content).getURICode(pool) == uriCode) {
                ((FixedElement)content).removeRedundantNamespaces(visitor, namespaceCodes);
            }
View Full Code Here

        int att = fat.getAttributeNameCode() & NamePool.FP_MASK;
        if (att == StandardNames.XSI_TYPE) {
            Expression attValue = fat.getSelect();
            if (attValue instanceof StringLiteral) {
                try {
                    NamePool pool = env.getNamePool();
                    String[] parts = env.getConfiguration().getNameChecker().getQNameParts(
                            ((StringLiteral)attValue).getStringValue());
                    // The only namespace bindings we can trust are those declared on this element
                    // TODO: we could also trust those on enclosing LREs in the same function/template,
                    int uriCode = -1;
                    for (int n=0; n<namespaceCodes.length; n++) {
                        String prefix = pool.getPrefixFromNamespaceCode(namespaceCodes[n]);
                        if (prefix.equals(parts[0])) {
                            uriCode = namespaceCodes[n] & 0xffff;
                            break;
                        }
                    }
                    if (uriCode == -1) {
                        return null;
                    }
                    String uri = pool.getURIFromURICode((short)uriCode);
                    int typefp = pool.allocate(parts[0], uri, parts[1]) & NamePool.FP_MASK;
                    return env.getConfiguration().getSchemaType(typefp);
                } catch (QNameException e) {
                    throw new XPathException(e.getMessage());
                }
            }
View Full Code Here

                    localNamespaces[n+1] = -1;
                }
                return;
            }
            if ((nn & 0xffff0000) == (nscode & 0xffff0000)) {
                NamePool pool = config.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 = config.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());
                            ((StartElementEvent)start).addNamespace(nscode);
                            continue;
                        } else if (k == Type.ATTRIBUTE) {
                            ((StartElementEvent)start).addAttribute((NodeInfo)pe);
View Full Code Here

    /**
    * Called when an instruction in the stylesheet gets processed
    */

    public void enter(InstructionInfo instruction, XPathContext context) {
        NamePool pool = context.getNamePool();
        int loc = instruction.getConstructType();
        if (loc == StandardNames.XSL_FUNCTION || loc == StandardNames.XSL_TEMPLATE) {
            String tag = "<";
            tag += (loc==StandardNames.XSL_FUNCTION ? "function" : "template");
            String name = null;
View Full Code Here

    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

     * 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

        afterEndTag = omit==null || !Whitespace.trim(omit).equals("yes") ||
                    props.getProperty(OutputKeys.DOCTYPE_SYSTEM)!=null ;
        s = props.getProperty(SaxonOutputKeys.SUPPRESS_INDENTATION);
        if (s != null) {
            suppressedElements = new IntHashSet(8);
            NamePool pool = getNamePool();
            StringTokenizer st = new StringTokenizer(s, " \t\r\n");
            while (st.hasMoreTokens()) {
                String clarkName = st.nextToken();
                int fp = pool.allocateClarkName(clarkName);
                suppressedElements.add(fp);
            }
        }
    }
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.