Java XML NodeList combineNodeLists(NodeList successfulReportList, NodeList failedAssertList)

Here you can find the source of combineNodeLists(NodeList successfulReportList, NodeList failedAssertList)

Description

Combine two NodeList objects into an array of Node objects.

License

Open Source License

Parameter

Parameter Description
successfulReportList a NodeList of successfull reports.
failedAssertLists a NodeList of failed asserts.

Return

an array of Node objects containing the result elements.

Declaration

public static Node[] combineNodeLists(NodeList successfulReportList, NodeList failedAssertList) 

Method Source Code

//package com.java2s;
/*/*from   w  ww.  j  a  v  a 2s  .com*/
    
MiringValidator  Semantic Validator for MIRING compliant HML
Copyright (c) 2015 National Marrow Donor Program (NMDP)
    
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
    
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
License for more details.
    
You should have received a copy of the GNU Lesser General Public License
along with this library;  if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
    
> http://www.gnu.org/licenses/lgpl.html
    
*/

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    /**
     * Combine two NodeList objects into an array of Node objects.
     *
     * @param successfulReportList a NodeList of successfull reports.
     * @param failedAssertLists a NodeList of failed asserts.
     * @return an array of Node objects containing the result elements.
     */
    public static Node[] combineNodeLists(NodeList successfulReportList, NodeList failedAssertList) {
        Node[] newList = new Node[successfulReportList.getLength() + failedAssertList.getLength()];

        for (int i = 0; i < successfulReportList.getLength(); i++) {
            newList[i] = successfulReportList.item(i);
        }
        for (int i = 0; i < failedAssertList.getLength(); i++) {
            newList[i + successfulReportList.getLength()] = failedAssertList.item(i);
        }
        return newList;
    }
}

Related

  1. addAll(final Node dst, final NodeList src)
  2. asList(final NodeList scripts)
  3. asList(NodeList nodeList)
  4. canonizeNodeList(NodeList nodelist)
  5. combine(final NodeList... nls)
  6. containsElementByValue(NodeList elements, String value)
  7. containsNature(NodeList nodes, String nature)
  8. convertNodelistToSet(NodeList xpathNodeSet)
  9. convertToArray(NodeList e)