/** * 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; }