Streams all children of this element. Children elements are represented by
{@link XQuery} objects as well.

@return {@link Stream} of children
551584
public @Nonnull Stream<XQuery> stream() {
        return new NodeListSpliterator(node.getChildNodes()).stream()
                        .filter(it -> it instanceof Element)
                        .map(XQuery::new);
    }
706171
Map<Integer, StreamState> activeStreams() {
        Map<Integer, StreamState> streams = new TreeMap<Integer, StreamState>(streamComparator);
        streams.putAll(activeStreams);
        return streams;
    }
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;
    }
908367
@Override
    public <T extends Event> Stream<T> createStream(String name, KeyFinder<T> finder, ProcessingElement... processingElements) {
        return super.createStream(name, finder, processingElements);
    }
889662
public static <R> Stream<R> of(Iterable<R> iterable) {
        return new Stream<R>(iterable.iterator());
    }
503597
public static <T> Stream<T> stream(T root, Function<? super T, ? extends Stream<T>> edges)
    {
        return StreamSupport.stream(spliterator(root, edges), false);
    }
1104613
public static Stream<Integer> stream(int[] self) {
        return IntStream.range(0, self.length).mapToObj(i -> self[i]);
    }
1215005
public List<AstNode> removeAllChildren() {
        if (this.children.isEmpty()) {
            return new ArrayList<AstNode>(0);
        }
        List<AstNode> copyOfChildren = new ArrayList<AstNode>(this.children);
        for (Iterator<AstNode> childIter = this.children.iterator(); childIter.hasNext();) {
            AstNode child = childIter.next();
            childIter.remove();
            child.parent = null;
        }
        return copyOfChildren;
    }
955087
@SuppressWarnings("unchecked")
    public static <T> Stream<Class<? extends T>> streamClasses(Collection<Class<?>> classes,
            Class<? extends T> baseClass) {
        return classes
                .stream()
                .filter(ClassPredicates.classIsDescendantOf(baseClass))
                .map(c -> (Class<T>) c);
    }
84499
public Iterator childNodes() {
        return new Iterator() {
            private final Iterator iter = Node.this.children.iterator();
            private Object nextElementNodes = getNextElementNodes();

            public boolean hasNext() {
                return this.nextElementNodes != null;
            }

            public Object next() {
                try {
                    return this.nextElementNodes;
                } finally {
                    this.nextElementNodes = getNextElementNodes();
                }
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }

            private Object getNextElementNodes() {
                while (iter.hasNext()) {
                    final Object node = iter.next();
                    if (node instanceof Node) {
                        return node;
                    }
                }
                return null;
            }
        };
    }
1332223
public Collection<CallTreeNode> getChildren() {
		return children == null ? Collections.<CallTreeNode>emptyList() : children.values();
	}
340900
public List<Node> childNodesCopy() {
        final List<Node> nodes = ensureChildNodes();
        final ArrayList<Node> children = new ArrayList<>(nodes.size());
        for (Node node : nodes) {
            children.add(node.clone());
        }
        return children;
    }
221703
public static XElement parseXMLActiveFragment(XMLStreamReader in) throws XMLStreamException {
        XElement node = null;
        XElement root = null;
        final StringBuilder emptyBuilder = new StringBuilder();
        StringBuilder b = null;
        Deque<StringBuilder> stack = new LinkedList<>();

        int type = in.getEventType();
        
        for (;;) {
            switch(type) {
            case XMLStreamConstants.START_ELEMENT:
                if (b != null) {
                    stack.push(b);
                    b = null;
                } else {
                    stack.push(emptyBuilder);
                }
                XElement n = new XElement(in.getName().getLocalPart());
                n.parent = node;
                int attCount = in.getAttributeCount();
                if (attCount > 0) {
                    for (int i = 0; i < attCount; i++) {
                        n.set(in.getAttributeLocalName(i), in.getAttributeValue(i));
                    }
                }
                if (node != null) {
                    node.add(n);
                }
                node = n;
                if (root == null) {
                    root = n;
                }
                break;
            case XMLStreamConstants.CDATA:
            case XMLStreamConstants.CHARACTERS:
                if (node != null && !in.isWhiteSpace()) {
                    if (b == null) {
                        b = new StringBuilder();
                    }
                    b.append(in.getText());
                }
                break;
            case XMLStreamConstants.END_ELEMENT:
                if (node != null) {
                    if (b != null) {
                        node.content = b.toString();
                    }
                    node = node.parent;
                }
                b = stack.pop();
                if (b == emptyBuilder) {
                    b = null;
                }
                if (stack.isEmpty()) {
                    return root;
                }
                break;
            default:
                // ignore others.
            }
            
            if (in.hasNext()) {
                type = in.next();
            } else {
                break;
            }
        }
        return root;
    }
190848
public static XElement parseXML(XMLStreamReader in) throws XMLStreamException {
        XElement root = parseXMLFragment(in);
        in.close();
        return root;
    }
54933
public static Stream<Node> stream(Node parent) {
        if (parent == null) {
            return Stream.empty();
        } else {
            return StreamSupport.stream(spliteratorUnknownSize(iterator(parent), 0), false);
        }
    }
336184
@Override
    public ReactiveSeq<T> stream() {
        listeningStreams.incrementAndGet(); //assumes all Streams that ever connected, remain connected
        return ReactiveSeq.fromStream(closingStream(this::get, new AlwaysContinue()));
    }
980115
function nodeStream(node) {
    var result = [];
    (function (node, offset) {
      for (var i = 0; i < node.childNodes.length; i++) {
        if (node.childNodes[i].nodeType == 3)
          offset += node.childNodes[i].nodeValue.length;
        else if (node.childNodes[i].nodeName == 'BR')
          offset += 1;
        else if (node.childNodes[i].nodeType == 1) {
          result.push({
            event: 'start',
            offset: offset,
            node: node.childNodes[i]
          });
          offset = arguments.callee(node.childNodes[i], offset);
          result.push({
            event: 'stop',
            offset: offset,
            node: node.childNodes[i]
          });
        }
      }
      return offset;
    })(node, 0);
    return result;
  }