NodeProxy parent = new NodeProxy(p.getDocument(), gid, Node.ELEMENT_NODE);
NodeProxy parent = ancestors.get(p.getDocument(), gid); if (parent == null) parent = new NodeProxy(p.getDocument(), gid, Node.ELEMENT_NODE);
    public NodeSet getAncestors(boolean rememberContext, boolean includeSelf) {        NodeSet ancestors = new ExtArrayNodeSet();        NodeProxy p;        long gid;        for (Iterator i = iterator(); i.hasNext();) {            p = (NodeProxy) i.next();            if (includeSelf) {            	if (rememberContext)            		p.addContextNode(p);                ancestors.add(p);            }            gid = p.gid;            // calculate parent's gid            while((gid = XMLUtil.getParentId(p.getDocument(), gid)) > 0) {                NodeProxy parent = new NodeProxy(p.getDocument(), gid, Node.ELEMENT_NODE);                if (rememberContext)                    parent.addContextNode(p);                else                    parent.copyContext(p);                ancestors.add(parent);            }        }        return ancestors;    }