Element (String cname, Namespace namespace) { for (Content child : content) { if (child instanceof Element) { Element element = (Element)child; if (element.name.equals(cname) && (namespace == null || namespace.equals(element.namespace))) { return element; } } } return null; }