Return-Path: X-Original-To: apmail-ws-dev-archive@www.apache.org Delivered-To: apmail-ws-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CBA979D4E for ; Mon, 27 Feb 2012 20:45:11 +0000 (UTC) Received: (qmail 27781 invoked by uid 500); 27 Feb 2012 20:45:11 -0000 Delivered-To: apmail-ws-dev-archive@ws.apache.org Received: (qmail 27555 invoked by uid 500); 27 Feb 2012 20:45:10 -0000 Mailing-List: contact dev-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ws.apache.org Delivered-To: mailing list dev@ws.apache.org Received: (qmail 27548 invoked by uid 99); 27 Feb 2012 20:45:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 20:45:10 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of andreas.veithen@gmail.com designates 209.85.216.42 as permitted sender) Received: from [209.85.216.42] (HELO mail-qw0-f42.google.com) (209.85.216.42) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 20:45:05 +0000 Received: by qaui11 with SMTP id i11so1559717qau.1 for ; Mon, 27 Feb 2012 12:44:25 -0800 (PST) Received-SPF: pass (google.com: domain of andreas.veithen@gmail.com designates 10.224.177.145 as permitted sender) client-ip=10.224.177.145; Authentication-Results: mr.google.com; spf=pass (google.com: domain of andreas.veithen@gmail.com designates 10.224.177.145 as permitted sender) smtp.mail=andreas.veithen@gmail.com; dkim=pass header.i=andreas.veithen@gmail.com Received: from mr.google.com ([10.224.177.145]) by 10.224.177.145 with SMTP id bi17mr12487424qab.17.1330375465503 (num_hops = 1); Mon, 27 Feb 2012 12:44:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=B0EmY+lOF5VnEWcqZGju+K+apRM+IHBCdD+lVxnlkhA=; b=o41kR4/JFsAaQMAEXdDdN35w16gJLDt7LAhLbMBY+jelayIj/3olUzLk6Ux3+gAg8z GxzFPvfk7ROKRFCIglk4hqOwJ1slaOEdFxOa8LXAqWGkiy9nlYbf+RzT4zd38yRyqEke g9/EXPqdLdHzOH/Unk+hi1x2Mo2AYBI0KKe6o= Received: by 10.224.177.145 with SMTP id bi17mr10488156qab.17.1330375465329; Mon, 27 Feb 2012 12:44:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.253.9 with HTTP; Mon, 27 Feb 2012 12:44:05 -0800 (PST) In-Reply-To: References: From: Andreas Veithen Date: Mon, 27 Feb 2012 21:44:05 +0100 Message-ID: Subject: Re: Axiom looses information when a child element is re-added to its parent using #addChild To: dev@ws.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Should be fixed now (see AXIOM-411). Thanks for reporting this issue. Andreas On Thu, Feb 23, 2012 at 15:26, Kasun Gajasinghe wrote: > Hi, > > I've using Axiom for some work, and I've faced this issue that I think is= a > bug in Axiom. The issue occurs when a given OMElement is re-added to its > parent using parentOMElement#addChild method. In that case, the said pare= nt > loses references to all the children after the child OMElement. > > To make it clear consider the sample xml doc [1]. Now, say you retrieved = the > operation named "Sandesha2OperationInOnly", by xpath or any other means. > Then, you re add it to the parent . After that, service loose > references to siblings after the said retrieved element (ie. an= d > ). I've provided a sample code for this which I've simplified = to > not use xpath for better understanding. [2] > > Yes, I can do a validation on whether I'm adding a child to the same pare= nt, > but why? This should be handled at Axiom level. The example was a much > simplified version; I've spent hours wondering how I lost all those > information, and found that a seemingly innocent method invocation was th= e > cause! :) Can anyone reproduce this? I'd like to provide a patch for this= . > > [1] > > =A0 =A0 > =A0 =A0 > =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 > =A0 =A0 val1 > > > [2] > OMElement documentEle =3D new > StAXOMBuilder("resources/services-op-test.xml").getDocumentElement(); > > // Now retrieve=A0 > OMElement opElement2 =3D (OMElement) > documentEle.getFirstElement().getNextOMSibling().getNextOMSibling(); > //OMElement opElement2 =3D new > AXIOMXPath("/service/operation[@name=3D\"Sandesha2OperationInOnly\"]").se= lectSingleNode(documentEle); > > documentEle.addChild(opElement2); > > > -- > ~~~*******'''''''''''''*******~~~ > Kasun Gajasinghe > Software Engineer; WSO2 Inc.;=A0http://wso2.com, > linked-in:=A0http://lk.linkedin.com/in/gajasinghe > blog:=A0http://blog.kasunbg.org > > > twitter:=A0http://twitter.com/kasunbg > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org For additional commands, e-mail: dev-help@ws.apache.org