Package org.exist.dom

Examples of org.exist.dom.NodeListImpl


     * (non-Javadoc)
     *
     * @see org.w3c.dom.Document#getElementsByTagName(java.lang.String)
     */
    public NodeList getElementsByTagName(String name) {
        final NodeListImpl nl = new NodeListImpl();
        for (int i = 1; i < size; i++) {
            if (nodeKind[i] == Node.ELEMENT_NODE) {
                final QName qn = nodeName[i];
                if (qn.getStringValue().equals(name)) {
                    nl.add(getNode(i));
                }
            }
        }
        return nl;
    }
View Full Code Here


     *
     * @see org.w3c.dom.Document#getElementsByTagNameNS(java.lang.String,
     *           java.lang.String)
     */
    public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
        final NodeListImpl nl = new NodeListImpl();
        for (int i = 1; i < size; i++) {
            if (nodeKind[i] == Node.ELEMENT_NODE) {
                final QName qn = nodeName[i];
                if (qn.getNamespaceURI().equals(namespaceURI) && qn.getLocalName().equals(localName)) {
                    nl.add(getNode(i));
                }
            }
        }
        return nl;
    }
View Full Code Here

    public boolean hasChildNodes() {
        return (getChildCount() > 0);
    }

    public NodeList getChildNodes() {
        final NodeListImpl nl = new NodeListImpl(1);
        final Element el = getDocumentElement();
        if (el != null)
            {nl.add(el);}
        return nl;
    }
View Full Code Here

            //collect test case information
            String folder = "";
            String scenario = "";
            String script = "";
            //DateTimeValue scriptDateTime = null;
            NodeListImpl inputFiles = new NodeListImpl();
            NodeListImpl outputFiles = new NodeListImpl();
            ElementImpl contextItem = null;
            NodeListImpl modules = new NodeListImpl();
            String expectedError = "";

            String name = null;

            NodeList childNodes = TC.getChildNodes();
            for (int i = 0; i < childNodes.getLength(); i++) {
                Node child = childNodes.item(i);
                switch (child.getNodeType()) {
                    case Node.ATTRIBUTE_NODE:
                        name = ((Attr)child).getName();
                        if (name.equals("FilePath"))
                            folder = ((Attr)child).getValue();
                        else if (name.equals("scenario"))
                            scenario = ((Attr)child).getValue();
                        break;
                    case Node.ELEMENT_NODE:
                        name = ((ElementImpl) child).getLocalName();
                        if (name.equals("query")) {
                            ElementImpl el = ((ElementImpl) child);
                            script = el.getAttribute("name");
                            //scriptDateTime = new DateTimeValue(el.getAttribute("date"));
                        }
                        else if (name.equals("input-file"))
                            inputFiles.add(child);
                        else if (name.equals("output-file"))
                            outputFiles.add(child);
                        else if (name.equals("contextItem"))
                            contextItem = (ElementImpl)child;
                        else if (name.equals("module"))
                            modules.add(child);
                        else if (name.equals("expected-error"))
                            expectedError = ((ElementImpl) child).getNodeValue();
                        break;
                    default :
                        ;
                }
            }

            Sequence result = null;

            //compile & evaluate
            File caseScript = new File(XQTS_folder+"Queries/XQuery/"+folder, script+".xq");
            try {
                XQueryContext context;

                context = xquery.newContext(AccessContext.TEST);

                //map modules' namespaces to location
                Map<String, String> moduleMap = (Map<String, String>)broker.getConfiguration().getProperty(XQueryContext.PROPERTY_STATIC_MODULE_MAP);
                for (int i = 0; i < modules.getLength(); i++) {
                    ElementImpl module = (ElementImpl)modules.item(i);
                    String id = module.getNodeValue();
                    moduleMap.put(module.getAttribute("namespace"), moduleSources.get(id));
                }
                broker.getConfiguration().setProperty(XQueryContext.PROPERTY_STATIC_MODULE_MAP, moduleMap);
View Full Code Here

        iterator.reset(path);
        return iterator;
    }

    private NodeList getFields(Element root) {
        NodeListImpl fields = new NodeListImpl();
        NodeList children = root.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node node = children.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE && FIELD_ELEM.equals(node.getLocalName())) {
                fields.add(node);
            }
        }
        return fields;
    }
View Full Code Here

    if (nl != null)
      return nl;
   
    DocumentAtExist document = getDocumentAtExist();
   
    nl = new NodeListImpl();
    int nextNode = document.getFirstChildFor(getNodeNumber());
    while (nextNode > getNodeNumber()) {
      NodeAtExist n = document.getNode(nextNode);

      if (n instanceof ElementAtExist) {
View Full Code Here

        select = atts.getValue("select");
        if (select == null)
          {throw new SAXException(
            localName + " requires a select attribute");}
        doc = builder.newDocument();
        contents = new NodeListImpl();
        inModification = true;
      } else if (
        (ELEMENT.equals(localName)
          || ATTRIBUTE.equals(localName)
          || TEXT.equals(localName)
View Full Code Here

    /* (non-Javadoc)
     * @see org.w3c.dom.Node#getChildNodes()
     */
    @Override
    public NodeList getChildNodes() {
        final NodeListImpl nl       = new NodeListImpl();
        int          nextNode = document.getFirstChildFor( nodeNumber );
        while( nextNode > nodeNumber ) {
            final Node n = document.getNode( nextNode );
            nl.add( n );
            nextNode = document.next[nextNode];
        }
        return( nl );
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String)
     */
    public NodeList getElementsByTagName( String name ) {
        final NodeListImpl nl       = new NodeListImpl();
        int          nextNode = nodeNumber;
        final int treeLevel = document.treeLevel[nodeNumber];
        while( ( ++nextNode < document.size ) && ( document.treeLevel[nextNode] > treeLevel ) ) {
            if( document.nodeKind[nextNode] == Node.ELEMENT_NODE ) {
                final QName qn = document.nodeName[nextNode];
                if( qn.getStringValue().equals( name ) ) {
                    nl.add( document.getNode( nextNode ) );
                }
            }
        }
        return( nl );
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String)
     */
    public NodeList getElementsByTagNameNS( String namespaceURI, String name ) {
        final QName        qname    = new QName( name, namespaceURI );
        final NodeListImpl nl       = new NodeListImpl();
        int          nextNode = nodeNumber;
        while( ++nextNode < document.size ) {
            if( document.nodeKind[nextNode] == Node.ELEMENT_NODE ) {
                final QName qn = document.nodeName[nextNode];
                if( qname.compareTo( qn ) == 0 ) {
                    nl.add( document.getNode( nextNode ) );
                }
            }
            if( document.next[nextNode] <= nodeNumber ) {
                break;
            }
View Full Code Here

TOP

Related Classes of org.exist.dom.NodeListImpl

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.