Package org.apache.commons.jxpath.ri

Examples of org.apache.commons.jxpath.ri.QName


        }

        for (int i = 0; i < steps.length; i++){
            Step step = steps[i];
            int defaultIndex = (i == steps.length - 1 ? -1 : 0);
            QName name = ((NodeNameTest)step.getNodeTest()).getNodeName();
            Expression predicates[] = step.getPredicates();

            // The following complicated logic is designed to translate
            // an xpath like "foo[@name='x'][@name='y'][3]/bar/baz[4]" into
            // a sequence of "single steps", each of which takes a node pointer,
View Full Code Here


            else {
                return pointer.getValuePointer();
            }
        }
        else {
            QName name;
            if (property instanceof QName){
                name = (QName)property;
            }
            else {
                name = new QName(null, (String)property);
            }
            NodeIterator it = parent.childIterator(new NodeNameTest(name), false, null);
            if (it != null && it.setPosition(index == -1 ? 1 : index + 1)){
                return it.getNodePointer();
            }
            else {
                PropertyPointer pointer = new NullPropertyPointer(parent);
                pointer.setPropertyName(name.toString());
                pointer.setIndex(index);
                return pointer.getValuePointer();
            }
        }
    }
View Full Code Here

        if (!setStarted){
            setStarted = true;
            if (!(nodeTest instanceof NodeNameTest)){
                return false;
            }
            QName name = ((NodeNameTest)nodeTest).getNodeName();
            iterator = parentContext.getCurrentNodePointer().attributeIterator(name);
        }

        if (iterator == null){
            return false;
View Full Code Here

            setStarted = true;
            if (!(nodeTest instanceof NodeNameTest)){
                return false;
            }

            QName testName = ((NodeNameTest)nodeTest).getNodeName();
            if (testName.getPrefix() != null){
                return false;
            }
            String testLocalName = testName.getName();
            if (testLocalName.equals("*")){
                iterator = parentContext.getCurrentNodePointer().namespaceIterator();
            }
            else {
                currentNodePointer = parentContext.getCurrentNodePointer().namespacePointer(testLocalName);
View Full Code Here

        }
        else if (test instanceof NodeNameTest) {
            if (!isNode()) {
                return false;
            }
            QName testName = ((NodeNameTest) test).getNodeName();
            QName nodeName = getName();
            String testPrefix = testName.getPrefix();
            String nodePrefix = nodeName.getPrefix();
            if (!equalStrings(testPrefix, nodePrefix)) {
                String testNS = getNamespaceURI(testPrefix);
                String nodeNS = getNamespaceURI(nodePrefix);
                if (!equalStrings(testNS, nodeNS)) {
                    return false;
                }
            }
            String testLocalName = testName.getName();
            if (testLocalName.equals("*")) {
                return true;
            }
            return testLocalName.equals(nodeName.getName());
        }
        else if (test instanceof NodeTypeTest) {
            if (((NodeTypeTest) test).getNodeType() == Compiler.NODE_TYPE_NODE) {
                return isNode();
            }
View Full Code Here

            // TBD: the following needs to be redesigned.  What this condition says is
            // "if the parent of this node has already appended this node's name,
            // don't do it again".  However, I would hate to add an ugly API like
            // "isResponsibleForAppendingChildName()".
            if (getParent().isNode() || (parent instanceof NullElementPointer)) {
                QName name = getName();
                if (name != null) {
                    buffer.append('/');
                    buffer.append(name);
                }
            }
        }
        else {
            QName name = getName();
            buffer.append(name);
        }
        if (index != WHOLE_COLLECTION && isCollection()) {
            buffer.append('[').append(index + 1).append(']');
        }
View Full Code Here

    }

    public QName getName(){
        int type = node.getNodeType();
        if (type == Node.ELEMENT_NODE){
            return new QName(DOMNodePointer.getPrefix(node), DOMNodePointer.getLocalName(node));
        }
        else if (type == Node.PROCESSING_INSTRUCTION_NODE){
            return new QName(null, ((ProcessingInstruction)node).getTarget());
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    public QName getExpandedName(){
        return new QName(getNamespaceURI(), getName().getName());
    }
View Full Code Here

    public LangAttributePointer(NodePointer parent){
        super(parent);
    }

    public QName getName(){
        return new QName(null, "lang");
    }
View Full Code Here

        this.prefix = prefix;
        this.namespaceURI = namespaceURI;
    }

    public QName getName(){
        return new QName(getNamespaceURI(), prefix);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jxpath.ri.QName

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.