HTML Render with example UI
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package org.openautonomousconnection.htmlparser.dom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class DomNode {
|
||||
protected DomNode parent;
|
||||
protected final List<DomNode> children = new ArrayList<>();
|
||||
|
||||
public DomNode getParent() { return parent; }
|
||||
public List<DomNode> getChildren() { return children; }
|
||||
|
||||
public void appendChild(DomNode child) {
|
||||
if (child == null) return;
|
||||
if (child.parent != null) child.parent.children.remove(child);
|
||||
child.parent = this;
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
public void removeChild(DomNode child) {
|
||||
if (child == null) return;
|
||||
if (children.remove(child)) child.parent = null;
|
||||
}
|
||||
|
||||
public abstract String nodeName();
|
||||
}
|
||||
Reference in New Issue
Block a user