use of org.loboevolution.html.node.NodeList in project LoboEvolution by LoboEvolution.
the class DOMTreeModel method setRoot.
private void setRoot(String rootNodeName) {
Node tempRoot = doc.getDocumentElement();
NodeList nl = tempRoot.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
if (nl.item(i).getNodeName().toLowerCase().equals(rootNodeName)) {
this.root = nl.item(i);
}
}
}
use of org.loboevolution.html.node.NodeList in project LoboEvolution by LoboEvolution.
the class DOMTreeModel method addDisplayable.
/**
* Adds a feature to the Displayable attribute of the DOMTreeModel object
*
* @param parent The feature to be added to the Displayable attribute
* @return Returns
*/
private List<Node> addDisplayable(Node parent) {
List<Node> children = this.displayableNodes.get(parent);
if (children == null) {
children = new ArrayList<>();
this.displayableNodes.put(parent, children);
NodeList nl = parent.getChildNodes();
for (int i = 0, len = nl.getLength(); i < len; i++) {
Node child = nl.item(i);
if (child.getNodeType() == NodeType.ELEMENT_NODE || child.getNodeType() == NodeType.COMMENT_NODE || (child.getNodeType() == NodeType.TEXT_NODE && (child.getNodeValue().trim().length() > 0))) {
children.add(child);
}
}
return children;
} else {
return new ArrayList<>();
}
}