Package xbird.xquery.misc.QNameTable

Examples of xbird.xquery.misc.QNameTable.QualifiedName


        parentStack.pop();
        return op;
    }

    public XQExpression visit(Variable variable, XQueryContext ctxt) throws XQueryException {
        final QualifiedName varname = variable.getVarName();
        if(!visitedVarNames.contains(varname)) {
            visitedVarNames.add(varname);
            final String node = "#" + counter + " Variable";
            addRootNode(node, variable);
            parentStack.push(node);
View Full Code Here


            final byte nodekind = nodetype.getNodeKind();
            switch(nodekind) {
                case NodeKind.ELEMENT:
                case NodeKind.ATTRIBUTE:
                case NodeKind.DOCUMENT:
                    QualifiedName qname = nodetype.getNodeName();
                    return QualifiedName.toJavaxQName(qname);
                default:
                    break;
            }
        }
View Full Code Here

    }

    public QName getTypeName() throws XQException {
        Type type = type_;
        if(type instanceof AtomicType) {
            QualifiedName qname = ((AtomicType) type).getTypeName();
            assert (qname != null);
            return QualifiedName.toJavaxQName(qname);
        }
        if(type instanceof DocumentTest) {
            type = ((DocumentTest) type).getNodeType();
        }
        if(type instanceof NodeType) {
            NodeType nodetype = (NodeType) type;
            final byte nodekind = nodetype.getNodeKind();
            switch(nodekind) {
                case NodeKind.ELEMENT:
                    ElementTest elementTest = (ElementTest) nodetype;
                    final QualifiedName elemType = elementTest.getTypeName();
                    if(elemType == null) {
                        return new QName("http://www.w3.org/2001/XMLSchema", "anyType", "xs");
                    } else {
                        return QualifiedName.toJavaxQName(elemType);
                    }
                case NodeKind.ATTRIBUTE:
                    AttributeTest attrTest = (AttributeTest) nodetype;
                    final QualifiedName attrType = attrTest.getTypeName();
                    if(attrType == null) {
                        return new QName("http://www.w3.org/2001/XMLSchema", "anyType", "xs");
                    } else {
                        return QualifiedName.toJavaxQName(attrType);
                    }
View Full Code Here

        final String expectedNamespace = module.getNamespace();
        if(expectedNamespace == null) {
            throw new XQueryException("err:XQST0046", "Library module MUST have a target namespace");
        }
        for(Variable v : globals) {
            QualifiedName varName = v.getVarName();
            XQExpression value = v.getValue();
            declareGlobalVariable(varName, value);
        }
    }
View Full Code Here

        // set parameters
        Enumeration<String> paramNames = req.getParameterNames();
        while(paramNames.hasMoreElements()) {
            String name = paramNames.nextElement();
            String value = req.getParameter(name);
            QualifiedName qname = QNameUtil.parse(name, XQSP_NSURI);
            Variable var = loadedModule.getVariable(qname);
            if(var != null && (var instanceof ExternalVariable)) {
                var.setResult(XString.valueOf(value));
            }
        }
View Full Code Here

        v1.setType(DoubleType.DOUBLE);
        VarRef p1 = new VarRef(v1);
        List<VarRef> params = new LinkedList<VarRef>();
        params.add(p1);
        // function
        QualifiedName fname = QNameTable.instantiate("java:java.lang.Math", "sqrt");
        Function f = new FunctionManager().lookupFunction(fname, params);
        assertNotNull(f);
        f.staticAnalysis(null, params);

        // invoke binded java method.
View Full Code Here

    }

    public QName getAttributeName(int index) {
        checkConditionForAttribute();
        final XQNode node = currentEvent_.getNode();
        final QualifiedName attname;
        if(node instanceof DTMElement) {
            final DTMAttribute att = ((DTMElement) node).attribute(index);
            if(att == null) {
                throw new IndexOutOfBoundsException(); // REVIEWME what's needed by the spec ?
            }
View Full Code Here

        }
        checkConditionForAttribute();
        final XQNode node = currentEvent_.getNode();
        final DMNode proxy = node.asDMNode();
        for(DMAttribute att : proxy.attribute()) {
            final QualifiedName attname = att.nodeName();
            assert (attname != null);
            if(localName.equals(attname.getLocalPart())) {
                if(namespaceURI == null || namespaceURI.equals(attname.getNamespaceURI())) {
                    return att.getContent();
                }
            }
        }
        return null;
View Full Code Here

        if(ev == START_ELEMENT) {
            final NamespaceBinder namespaces = namespaces_;
            namespaces.pushContext();
            final DMNode elem = node.asDMNode();
            for(DMNamespace ns : elem.namespaceNodes()) {
                final QualifiedName qname = ns.nodeName();
                final String prefix;
                if(qname != null) {
                    prefix = qname.getLocalPart();
                } else {
                    prefix = "";
                }
                final String uri = ns.getContent();
                namespaces.declarePrefix(prefix, uri);
View Full Code Here

            signs[i].writeExternal(out);
        }
    }

    public void writeTo(ObjectOutput out) throws IOException {
        final QualifiedName name = getName();
        if(name == null) {
            throw new IllegalStateException();
        }
        name.writeExternal(out);
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.misc.QNameTable.QualifiedName

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.