Package net.sf.saxon.om

Examples of net.sf.saxon.om.NamePool


            String dbCol = arguments[COLUMN].evaluateAsString(context).toString();
            String dbTab = arguments[TABLE].evaluateAsString(context).toString();
            String dbWhere = arguments[WHERE].evaluateAsString(context).toString();


            NamePool pool = controller.getNamePool();
            int rowCode = pool.allocate("", "", rowTag);
            int colCode = pool.allocate("", "", colTag);

            PreparedStatement ps = null;
            ResultSet rs = null;
            XPathException de = null;
View Full Code Here


        }
        if (type instanceof NodeTest) {
            IntHashSet set = ((NodeTest)itemType).getRequiredNodeNames();
            if (set.size() == 1) {
                int fp = set.getFirst(-1);
                NamePool pool = config.getNamePool();
                String uri = pool.getURI(fp);
                String local = pool.getLocalName(fp);
                return new QName(uri, local);
            } else {
                return null;
            }
        }
View Full Code Here

    public QName getTypeName() throws XQException {
        ItemType type = itemType;
        if (type instanceof AtomicType) {
            int fp = ((AtomicType)type).getFingerprint();
            NamePool pool = config.getNamePool();
            String uri = pool.getURI(fp);
            String local = pool.getLocalName(fp);
            return new QName(uri, local);
        }
        if (type instanceof DocumentNodeTest) {
            type = ((DocumentNodeTest)type).getElementTest();
        }
        if (type instanceof NodeTest) {
            SchemaType t = ((NodeTest)type).getContentType();
            if (t != null) {
                int fp = ((NodeTest)type).getContentType().getFingerprint();
                NamePool pool = config.getNamePool();
                String uri = pool.getURI(fp);
                String local = pool.getLocalName(fp);
                return new QName(uri, local);
            }
        }
        throw new XQException("getTypeName() failed: itemType is not a document, element, or attribute test");
    }
View Full Code Here

                    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

        }
        String uri = elparts2[0];
        String local = elparts2[1];
        String prefix = NameChecker.getPrefix(elparts2[2]);

        NamePool namePool = config.getNamePool();
        int nameCode = namePool.allocate(prefix, uri, local);

        receiver.startElement(nameCode, StandardNames.XS_UNTYPED, 0, 0);
        for (Iterator iter = nsDeclarations.keySet().iterator(); iter.hasNext();) {
            String nsprefix = (String)iter.next();
            String nsuri = (String)nsDeclarations.get(nsprefix);
            receiver.namespace(namePool.allocateNamespaceCode(nsprefix, nsuri), 0);
        }

        if (atts != null) {
            final int len = atts.getLength();
            for (int a2=0; a2<len; a2++) {
                Attr att = (Attr)atts.item(a2);
                String attname = att.getName();
                if (attname.startsWith("xmlns") && (attname.equals("xmlns") || attname.startsWith("xmlns:"))) {
                    // do nothing
                } else {
                    //System.err.println("Processing attribute " + attname);
                    String[] parts2 = nsSupport.processName(attname, parts, true);
                    if (parts2==null) {
                          throw new XPathException("Undeclared namespace in " + attname);
                    }
                    String atturi = parts2[0];
                    String attlocal = parts2[1];
                    String attprefix = NameChecker.getPrefix(parts2[2]);

                    int attCode = namePool.allocate(attprefix, atturi, attlocal);

                    receiver.attribute(attCode, StandardNames.XS_UNTYPED_ATOMIC, att.getValue(), 0, 0);
                }
            }
        }
View Full Code Here

    private static String getInstructionName(InstructionInfoProvider inst, XPathContext context) {
        // TODO: subclass this for XSLT and XQuery
        if (context==null) {
            return "";
        }
        NamePool pool = context.getNamePool();
        try {
            InstructionInfo info = inst.getInstructionInfo();
            int construct = info.getConstructType();
            if (construct < 1024 &&
                    construct != StandardNames.XSL_FUNCTION &&
View Full Code Here

    public static PreparedStylesheet loadCompiledStylesheet(Configuration config, ObjectInputStream ois)
            throws IOException, ClassNotFoundException {
        PreparedStylesheet sheet = (PreparedStylesheet)ois.readObject();
        ois.close();
        NamePool compiledNamePool = sheet.getTargetNamePool();
        sheet.setConfiguration(config);
        sheet.getExecutable().setConfiguration(config);
        config.setNamePool(compiledNamePool);
        NamePool.setDefaultNamePool(compiledNamePool);
        return sheet;
View Full Code Here

     * @param properties Bit field holding special properties of the element
     */

    public void startElement(int nameCode, int typeCode, int locationId, int properties) throws XPathException {
        if (!committed) {
            NamePool namePool = getNamePool();
            String name = namePool.getLocalName(nameCode);
            short uriCode = namePool.getURICode(nameCode);
            if (name.equalsIgnoreCase("html") && uriCode==NamespaceConstant.NULL_CODE) {
                switchToMethod("html");
            } else if (name.equals("html") && namePool.getURIFromURICode(uriCode).equals(NamespaceConstant.XHTML)) {
                String version = outputProperties.getProperty(SaxonOutputKeys.STYLESHEET_VERSION);
                if ("1".equals(version)) {
                    switchToMethod("xml");
                } else {
                    switchToMethod("xhtml");
View Full Code Here

     * Type-check the expression
     */

    public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {

        NamePool namePool = visitor.getConfiguration().getNamePool();
        TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy();
        StaticContext env = visitor.getStaticContext();

        operand0 = visitor.typeCheck(operand0, contextItemType);
        if (Literal.isEmptySequence(operand0)) {
View Full Code Here

        ItemType supplied = operand.getItemType(th);
        int relation = th.relationship(requiredItemType, supplied);
        if (relation == TypeHierarchy.SAME_TYPE || relation == TypeHierarchy.SUBSUMES) {
            return operand;
        } else if (relation == TypeHierarchy.DISJOINT) {
            final NamePool namePool = visitor.getConfiguration().getNamePool();
            if (Cardinality.allowsZero(card)) {

                String message = role.composeErrorMessage(
                        requiredItemType, operand.getItemType(th), namePool);
                visitor.getStaticContext().issueWarning("The only value that can pass type-checking is an empty sequence. " +
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.