@Override public void visit(ERXML.Visitor visitor) { if (visitor.visit(this)) { for (ERXML.Item item : _children) { item.visit(visitor); } } }
/** * Returns the XML document, or null if it isn't in a document. * * @return the XML document, or null if it isn't in a document */ public ERXML.Doc doc() { ERXML.Item item = this; ERXML.Item parent = null; while ((parent = item.parent()) != null) { item = parent; } ERXML.Doc doc = null; if (item instanceof ERXML.Doc) { doc = (ERXML.Doc) item; } return doc; }
@Override public void write(PrintWriter writer, int indent) { for (ERXML.Item item : _children) { item.write(writer, indent); } }
/** * Adds a new child to this document. * * @param child the child to add */ protected void _add(ERXML.Item child) { child.setParent(this); _children.add(child); }