You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Sanjiva Weerawarana <sa...@opensource.lk> on 2004/06/22 07:24:46 UTC

unexpected behaviour with MessageElement constructors ..

org.apache.axis.message.MessageElement has as constructors the
following (amongst others):

    public MessageElement(String localPart, String prefix, String namespace)
    public MessageElement(String namespace, String localPart, Object value)

I wanted to create the following as a header:
    <a:yy xmlns:a="urn:xx">hello</a:yy>

So, I did:
    new MessageElement ("urn:xx", "yy", "hello")
of course that doesn't work .. it uses the wrong constructor and creates
    <yy:urn:xx xmlns:yy="hello"/>

Not quite the same thing. I of course could work around it by casting
"hello" like this: (Object)"hello".

While strictly not a bug, this is a bit weird and error-prone and hence
should be fixed IMO. My preference would be to remove the first of
the above constructors .. but clearly that's not backwards compatible.

Sanjiva.