axel/src/main/java/fr/xgouchet/xmleditor/core/model/XmlNode.java
@Nullable
    public XmlNode findNodeWithType(final @XmlUtils.XmlNodeType int type) {
        // easy
        if (type == getDataType()) {
            return this;
        }

        XmlNode node, best = null;
        for (TreeNode<XmlContent> child : getChildren()) {

            node = ((XmlNode) child).findNodeWithType(type);

            if (node == null) {
                continue;
            }

            if ((best == null) || (node.getDepth() < best.getDepth())) {
                best = node;
                if (best.getDepth() == (getDepth() + 1)) {
                    break;
                }
            }
        }

        return best;
    }
/**
     * Search in this node and its children for a node with the given type. The first node to match
     * the type is returned.
     *
     * @param type the type to look for
     * @return the top and first node with the given XML type, or null if none is found.
     */
Search in this node and its children for a node with the given type. The first node to match
the type is returned.

@param type the type to look for
@return the top and first node with the given XML type, or null if none is found.
Search in this node and its children for a node with the given type . The first node to match the type is returned . @param type the type to look for @return the top and first node with the given XML type or null if none is found .
@Nullable
    public XmlNode findNodeWithType(final @XmlUtils.XmlNodeType int type) {
        if (type == getDataType()) {
            return this;
        }
        XmlNode node, best = null;
        for (TreeNode<XmlContent> child : getChildren()) {
            node = ((XmlNode) child).findNodeWithType(type);
            if (node == null) {
                continue;
            }
            if ((best == null) || (node.getDepth() < best.getDepth())) {
                best = node;
                if (best.getDepth() == (getDepth() + 1)) {
                    break;
                }
            }
        }
        return best;
    }
@ Nullable public XmlNode findNodeWithType ( final @ XmlUtils . XmlNodeType int type ) { if ( type == getDataType ( ) ) { return this ; } XmlNode node , best = null ; for ( TreeNode < XmlContent > child : getChildren ( ) ) { node = ( ( XmlNode ) child ) . findNodeWithType ( type ) ; if ( node == null ) { continue ; } if ( ( best == null ) || ( node . getDepth ( ) < best . getDepth ( ) ) ) { best = node ; if ( best . getDepth ( ) == ( getDepth ( ) + 1 ) ) { break ; } } } return best ; }
Search in this node and its children for a node with the given type.
Search in this node and its children for a node with the given type .
// easy