Christian Kloner wrote:
hi,

In OMNamespaceImpl class a commodity method named "equals(String namespaceUri)" is missing!at the moment only this one is there, but it returns false if only the prefixes are different.

    public boolean equals(String uri, String prefix) {
        return (((prefix == null) && (this.prefix == null)) ||
                ((prefix != null) && prefix.equals(this.prefix))) &&
                ((uri == null) && (this.uri == null) ||
                        (uri != null) && uri.equals(this.uri));

    }

at the moment you have to write ugly code like this to get rid of: element.getNamespace().getNamespaceURI().equals(namespaceURI)

1. it's not best practice to overload java.lang.Object#equals(Object) and 2. I agree with you that equality according to the XML namespace semantics should not consider any namespace prefixes (e.g. see the javax.xml.namespace.QName implementation).

So the existing equals(String, String) method should probably be removed or renamed to avoid confusion.

An org.apache.axiom.om.OMElement#belongsToNamespace(String) method would probably suit your needs. However I'm not sure if it would be wise to introduce such methods into the API.

--
Regards,
Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to