protected static Stream<Node> asStream(NodeList nodeList) {
        if (nodeList == null) {
            return new ArrayList<Node>().stream();
        } else {
            AtomicInteger n = new AtomicInteger(0);
            return Stream.generate(() -> nodeList.item(n.getAndIncrement())).limit(nodeList.getLength());
        }
    }
@Test
    public void asStream() throws Exception {
        Document document = DOMParserUtil.getDocument(XML);
        final NodeList mainNodeList = document.getElementsByTagName("Main");
        commonCheckNodeStream(mainNodeList);
        final NodeList childNodesList = mainNodeList.item(0).getChildNodes();
        commonCheckNodeStream(childNodesList);
        final NodeList innerNodesList = childNodesList.item(0).getChildNodes();
        commonCheckNodeStream(innerNodesList);
    }