Cast result object to a nodelist. (special function).

@return The document fragment as a nodelist
771107
public NodeList convertToNodeset()
  {

    if (m_obj instanceof NodeList)
      return (NodeList) m_obj;
    else
      return new org.apache.xml.dtm.ref.DTMNodeList(asNodeIterator());
  }
1286692
@Nullable
  private static Node getNode(Document doc, String parentNodeName, String targetNodeName) {
    NodeList parentElements = doc.getElementsByTagNameNS(APP_ENGINE_NAMESPACE, parentNodeName);
    if (parentElements.getLength() > 0) {
      Node parent = parentElements.item(0);
      if (parent.hasChildNodes()) {
        for (int i = 0; i < parent.getChildNodes().getLength(); i++) {
          Node child = parent.getChildNodes().item(i);
          if (child.getNodeName().equals(targetNodeName)) {
            return child;
          }
        }
      }
    }
    return null;
  }
820567
private ArrayList<E> toArrayList() {
        ArrayList<E> list = new ArrayList<>();
        for (Node<E> p = first(); p != null; p = succ(p)) {
            E item = p.item;
            if (item != null)
                list.add(item);
        }
        return list;
    }
1272449
public List<ColumnResult<SqlResultSetMapping<T>>> getAllColumnResult()
   {
      List<ColumnResult<SqlResultSetMapping<T>>> list = new ArrayList<ColumnResult<SqlResultSetMapping<T>>>();
      List<Node> nodeList = childNode.get("column-result");
      for(Node node: nodeList)
      {
         ColumnResult<SqlResultSetMapping<T>>  type = new ColumnResultImpl<SqlResultSetMapping<T>>(this, "column-result", childNode, node);
         list.add(type);
      }
      return list;
   }
582092
public Collection<Xml> getChildren(String name)
    {
        Check.notNull(name);

        final Collection<Xml> nodes = new ArrayList<>(1);
        final NodeList list = root.getChildNodes();
        for (int i = 0; i < list.getLength(); i++)
        {
            final Node node = list.item(i);
            if (name.equals(node.getNodeName()))
            {
                nodes.add(new Xml(document, (Element) node));
            }
        }
        return nodes;
    }
507848
public List<Node> getNodes(Collection<Long> nodeIds)
	{
		if(nodeIds.isEmpty()) return Collections.emptyList();
		return getSomeElements(NODE + "s?" + NODE + "s=" + toCommaList(nodeIds), Node.class);
	}
598531
public List list() {
        final Iterator iter = nodeIterator();
        final List result = new LinkedList();
        while (iter.hasNext()) {
            result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints));
        }
        return result;
    }
1074612
private Map<String, String> asMap(NodeList kvList) {
    	Map<String, String> rt = new HashMap<String, String>();
    	
    	for (int i = 0; i < kvList.getLength(); ++i) {
    		Node item = kvList.item(i);
    		NodeList itemChildren = item.getChildNodes();
    		
    		if (item.getNodeType() != Node.ELEMENT_NODE) {
    			continue;
    		}
    		
    		String key = null;
    		String value = null;
    		
    		for (int j = 0; j < itemChildren.getLength(); ++j) {
    			Node child = itemChildren.item(j);
    			
    			if (child.getNodeType() != Node.ELEMENT_NODE) {
        			continue;
        		}
    			
    			if ("key".equalsIgnoreCase(child.getNodeName())) {
    				key = child.getTextContent();
    			} else if ("value".equalsIgnoreCase(child.getNodeName())) {
    				value = child.getTextContent();
    			}
    		}
    		
    		if (key != null && value != null) {
    			rt.put(key, value);
    		} else {
    			LOGGER.error("Invalid K/V pair: key: " + key + ", value: " + value);
    		}
    	}
    	
    	return rt;
    }
487017
public List<T> getElements() {
		ArrayList<T> list = new ArrayList<>(nodes.size());
		for (Node<T> node : nodes)
			list.add(node.element);
		return list;
	}
	
	/** Return the number of elements. */
	public int size() { return nodes.size(); }
	
}
622614
public List<T> elementList() {

        if (m_cache != null) {
            return m_cache;
        }
        if (m_relativeOrdered) {
            List<T> objectList = new ArrayList<T>();
            Iterator<CmsIdObjectElement<T>> itObjs = m_orderedObjectList.iterator();
            while (itObjs.hasNext()) {
                CmsIdObjectElement<T> object = itObjs.next();
                objectList.add(object.getObject());
            }
            m_cache = Collections.unmodifiableList(objectList);
        } else {
            m_cache = Collections.unmodifiableList(m_objectList);
        }
        return m_cache;
    }
738468
public static List<Element> getAllChildElements(Element parent) {
        List<Element> result;
        NodeList nodes;
        int i;
        int max;
        Node node;

        result = new ArrayList<>();
        nodes = parent.getChildNodes();
        max = nodes.getLength();
        for (i = 0; i < max; i++) {
            node = nodes.item(i);
            if (node instanceof Element) {
                result.add((Element) node);
            }
        }
        return result;
    }
1198124
public NodeTypes getNodeTypes() {
        String url = jsonRestClient.appendToURL(ITEMS_METHOD, NODE_TYPES_SEGMENT);
        JSONRestClient.Response response = jsonRestClient.doGet(url);
        if (!response.isOK()) {
            throw new RuntimeException(JdbcI18n.invalidServerResponse.text(url, response.asString()));
        }
        return new NodeTypes(response.json());
    }
342778
public static List<Element> convertToElementList(org.w3c.dom.NodeList _nodeList) {
        List<org.w3c.dom.Element> elemList = new ArrayList<>();
        for (int i = 0; i < _nodeList.getLength(); i++) {
            Element elem = (org.w3c.dom.Element) _nodeList.item(i);
            elemList.add(elem);
        }
        return elemList;
    }
1224981
public @Nonnull String text() {
        return new NodeListSpliterator(node.getChildNodes()).stream()
                        .filter(it -> it instanceof Text)
                        .map(it -> ((Text) it).getNodeValue())
                        .collect(joining());
    }
1049038
@NonNull
  @Override
  public Iterator<Node> iterator() {
    int i = nextIndex.get();
    if (i >= nodes.length) {
      return Collections.<Node>emptyList().iterator();
    } else {
      return Iterators.forArray(Arrays.copyOfRange(nodes, i, nodes.length, Node[].class));
    }
  }
1329307
@Override
    public Map<String, Document> getFragmentLayoutCopies() {
        // since this is only visible in fragment list in administrative portlet, use default portal
        // locale
        final Locale defaultLocale = localeManagerFactory.getPortalLocales().get(0);

        final Map<String, Document> layouts = new HashMap<>();

        final List<FragmentDefinition> definitions = this.fragmentUtils.getFragmentDefinitions();
        for (final FragmentDefinition fragmentDefinition : definitions) {
            final Document layout = DocumentFactory.getThreadDocument();
            final UserView userView =
                    this.fragmentUtils.getUserView(fragmentDefinition, defaultLocale);
            if (userView == null) {
                logger.warn(
                        "No UserView found for FragmentDefinition {}, it will be skipped.",
                        fragmentDefinition.getName());
                continue;
            }
            final Node copy = layout.importNode(userView.getLayout().getDocumentElement(), true);
            layout.appendChild(copy);
            layouts.put(fragmentDefinition.getOwnerId(), layout);
        }
        return layouts;
    }
102809
public static NodeList xpathNodeList(Node document, String xpathExpression, Map<String, String> namespaceMapping) throws XPathException,
                MarshallingException
    {
        return (NodeList) executeXPath(document, xpathExpression, namespaceMapping, XPathConstants.NODESET);
    }