axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eran Chinthaka <chinth...@opensource.lk>
Subject Re: [AXIS2] Issue with writing SOAPMessage to stream in SAAJ over DOOM
Date Fri, 23 Dec 2005 02:56:49 GMT
Ok, one small mistake I have done.

Once u make the parser, namespaceAware, I get the correct behaviour for
the localname.

BUT, at the same time, getLocalName returns the correct value,
irrespective of whether the element has a namespace or not. Meaning the
current Dom RI is correct, once you make the parser namespace aware.

So Ruchith ............. :-)

Chinthaka

Eran Chinthaka wrote:

> Hmm, interesting discussion.
>
> Let me add something too.
> I wrote a sample code using DOM and it seems the current DomImpl is
> returning null for any element.getLocalName() call,  irrespective of
> whether it is qualified or not. This is bit of strange to me.
>
> I created a SOAPEnvelope and and called
> documentElement.getLocalName(), its returning null. But when I call
> getTagName(), it returns "soapenv:Envelope". So there is a problem in
> the current DOM impl too.
>
> BTW, looking at Ruchith's proposals, I don't like the options #1 as
> there he has tried to make the impl neutral code independant code,
> non-neutral by putting instance of checking. (Please see [1] for the
> code.)
>
> Anyway, I don't think those options are needed if Sanjiva's points are
> accepted :-)
>
> -- Chinthaka
>
>
> [1] : http://www.rafb.net/paste/results/IGuT5M12.html
>
>
>
> Sanjiva Weerawarana wrote:
>
> >On Thu, 2005-12-22 at 16:50 +0600, Ruchith Fernando wrote:
>
> >>Hi Azeez,
> >>
> >>This is a known issue in serializing *unqualified* xml elements.
>
>
> >First of all, IIRC the test envelope is wrong: children of
> ><soap:Body> *must* be qualified.
>
> >However, that does not excuse the NPE behavior :).
>
> >>org.apache.axis2.om.impl.llom.OMSerializerUtil was originally
> >>written to only work with LLOM OM implementation. And it uses
> >>getLocalName() of OMElement to get the local part of a qualified
> >>element OR the 'tag name' of a qualified element.
>
>
> >OK. (You meant "unqualified" in the last bit there I believe.)
>
> >>And now DOOM uses it to serialize DOOM elements. But according to
> >>the DOM APIs[1] (Proof: [2]) the when getLocalName() is called
> >>on an unqualified element it will be null. And DOOM does this
> >>properly to comply with DOM interfaces.
>
>
> >I just looked thru the DOM L2 spec [1] and AFAICT the behavior is
> >not clearly defined. In particular, it says:
>
> >"localName of type DOMString, readonly, introduced in DOM Level 2
> >Returns the local part of the qualified name of this node. For
> >nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and
> >nodes created with a DOM Level 1 method, such as createElement from
> >the Document interface, this is always null".
>
> >Note that it does not say what happens if the name was not
> >qualified at all. There's further discussion of namespace issues in
> >[2] but that does not clarify it either. So, at least to me, it
> >appears that you're noticing the behavior of the default DOM impl
> >rather than spec compliance.
>
> >>Therefore we have two options to solve this problem: 1.) Modify
> >>OMSerializerUtil to check for whether the element being
> >>serialized is a DOM element by checking instanceof
> >>org.w3c.Element and calling getTagName if the element is not
> >>namespace qualified.
> >>
> >>2.) Add another method to OMElement interface : public String
> >>getTagName() where we can use it in the case when we serialize an
> >>unqualified element (either LLOM or DOOM).
> >>
> >>What do you think?
>
>
> >If the spec indeed does not specify a given behavior, my preference
> >would be to change getLocalName() to return the name if the
> >OMElement is unqualified.
>
> >Sanjiva. [1]
> >http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html
> >[2]
> >http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#Namespaces-Considerations
>
>
>
>
>

Mime
View raw message