/** @see org.apache.axiom.om.OMElement#findNamespace(String, String) */ public OMNamespace findNamespace(String uri, String prefix) { // check in the current element OMNamespace namespace = findDeclaredNamespace(uri, prefix); if (namespace != null) { return namespace; } // go up to check with ancestors if (this.parentNode != null) { // For the OMDocumentImpl there won't be any explicit namespace // declarations, so going up the parent chain till the document // element should be enough. if (parentNode instanceof OMElement) { namespace = ((ElementImpl) parentNode).findNamespace(uri, prefix); } } if (namespace == null && uri != null && prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX) && uri.equals(OMConstants.XMLNS_URI)) { declareNamespace(OMConstants.XMLNS_URI, OMConstants.XMLNS_PREFIX); namespace = findNamespace(uri, prefix); } return namespace; }