Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 82476 invoked from network); 23 Dec 2005 03:12:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Dec 2005 03:12:54 -0000 Received: (qmail 46626 invoked by uid 500); 23 Dec 2005 03:12:49 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 46607 invoked by uid 500); 23 Dec 2005 03:12:48 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 46596 invoked by uid 99); 23 Dec 2005 03:12:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2005 19:12:48 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ruchith.fernando@gmail.com designates 64.233.184.203 as permitted sender) Received: from [64.233.184.203] (HELO wproxy.gmail.com) (64.233.184.203) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2005 19:12:47 -0800 Received: by wproxy.gmail.com with SMTP id i32so478387wra for ; Thu, 22 Dec 2005 19:12:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EcPzkhvKqSlCgA6xNs66q92eSMg/pJArO1XDIKk4w0L9v/OF9ajQcSK1cY31UGu4icDgL2c8ILCWdLHS4xczCJ86sapNO9cPPz4HbBglt2qH7hPWq4KYJsVAxUsdSvvPZbaJMUSFLmwVg0Sa3EnT3B7wr187vhzkRGNmiC6deEI= Received: by 10.64.180.14 with SMTP id c14mr697782qbf; Thu, 22 Dec 2005 19:12:26 -0800 (PST) Received: by 10.64.199.16 with HTTP; Thu, 22 Dec 2005 19:12:26 -0800 (PST) Message-ID: <559c463d0512221912j629b520aof4a53061635143b1@mail.gmail.com> Date: Fri, 23 Dec 2005 09:12:26 +0600 From: Ruchith Fernando To: axis-dev@ws.apache.org Subject: Re: [AXIS2] Issue with writing SOAPMessage to stream in SAAJ over DOOM In-Reply-To: <43AB5CDF.80805@opensource.lk> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <9b85c45f0512220215r823cc0ck330b99a891314064@mail.gmail.com> <559c463d0512220250veb71ed5y584b91b5625f30c7@mail.gmail.com> <1135294527.9158.8.camel@localhost.localdomain> <43AB5CDF.80805@opensource.lk> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi All, Seems like the trick with the sample code that Chinthaka and I posted is in the DocumentBuilderFactory of the default DOM impl. If we make the DocumentBuilderFactory instance namespace aware we have a behaviour similar to OM default behaviour. DocumentBuilderFactory.setNamespaceAware(true); And if the DocumentBuilderFactory instance is not namspace aware one then getLocalName() will return null all the time... Please note that this is the behaviour of the default DOM impl... :-) Ok... now since we can safely assume OM is namespace aware ... we can chage the getLocalName() in DOOM ElementImpl to comply with it. Problem solved :-) Thanks, Ruchith On 12/23/05, Eran Chinthaka wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > 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 > > *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#Namespa= ces-Considerations > > > > > > > > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2 (MingW32) > > iD8DBQFDq1zIjON2uBzUhh8RAuvTAKCWR0nV2GcrS7x/tnuojAS3J293HQCfScSZ > cMrz4uXHGPS+gGM8xXA2NK8=3D > =3DMyEi > -----END PGP SIGNATURE----- > > -- Ruchith