Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 77793 invoked from network); 3 Oct 2005 16:56:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Oct 2005 16:56:27 -0000 Received: (qmail 48382 invoked by uid 500); 3 Oct 2005 16:56:22 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 48314 invoked by uid 500); 3 Oct 2005 16:56:21 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 48303 invoked by uid 99); 3 Oct 2005 16:56:21 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Oct 2005 09:56:21 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=HTML_40_50,HTML_MESSAGE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of sam504u@gmail.com designates 64.233.184.205 as permitted sender) Received: from [64.233.184.205] (HELO wproxy.gmail.com) (64.233.184.205) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Oct 2005 09:56:26 -0700 Received: by wproxy.gmail.com with SMTP id i27so154356wra for ; Mon, 03 Oct 2005 09:55:59 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=spAXGkzWIq9kZ1huuX2uIKrKzlxC4lmsCNKqM6dVOyiJXReaIRtXdxsYtyG2F8+yuYXoWzMYGcqnGmDNjXLBJ7ot4LNSaos3dgniK6WqjgGCjznp0pv44XHeUqsgiXIVdRHc+ABUjQGefROAHamApRyTOaHDGk+1PgCjQzk7thA= Received: by 10.54.122.11 with SMTP id u11mr1591008wrc; Mon, 03 Oct 2005 09:55:59 -0700 (PDT) Received: by 10.54.68.19 with HTTP; Mon, 3 Oct 2005 09:55:59 -0700 (PDT) Message-ID: Date: Mon, 3 Oct 2005 12:55:59 -0400 From: Sameer Nanda Reply-To: Sameer Nanda To: commons-user@jakarta.apache.org, russellsimpkins@hotmail.com Subject: Fwd: Managing XML Output from Betwixt In-Reply-To: <224f32340510030908t2a5fb57bp5ff8f8d1c6c0a907@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2297_16800971.1128358559552" References: <224f32340510030908t2a5fb57bp5ff8f8d1c6c0a907@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_2297_16800971.1128358559552 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Tom, That will help I guess ( I dint try ) but the way you explained looks like its gonna do some magic. Ok but heres the thing, right now I got it working the exact same way I wan= t I just included this line in my Main class: beanWriter.getXMLIntrospector().setElementNameMapper(new DecapitalizeNameMapper()); and it did the trick, so now my XML is generated as I want it to be: read employee read customer write employee write customer Demo 569 Demo =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D But may be for my future I will keep this trick in mind and try using it. I havent actually started to use customizing the mappings of a beans to XML, but I think in the long run its gonna help, so I am kind of reading it righ= t now and will definetly try the method you said. Thanks again Russell, Tom. You guys are awesome. May be I will be back if I get stuck up with the advanced mapping of Beans to XMl. -Sameer ---------- Forwarded message ---------- From: Thomas Dudziak Date: Oct 3, 2005 12:08 PM Subject: Re: Managing XML Output from Betwixt To: Jakarta Commons Users List , Sameer Nanda On 10/3/05, Sameer Nanda wrote: > Well thanks again Russell, > > Whatever you said is true, I can either rename my Class to a lowercase > authorization (but then I am breaking the naming convention for writing Java > classes which I dont wanna do) , and I could also run the replaceAll() on > the XML string generated to replace all to > (but that would be a hack). > > My point here is, it shouldnt have to be like that ....... theres gotta b= e > something in Betwixt using which I can do this. I mean this is just one > example I am talking here, I have to generate much more complex XML > documents which would involve a lot of Java Bean Objects, which in turn > would contain a bunch of other Java Beans. Do you know what I mean? > > Again, Russell its not that I appreciate your ideas and the time you have > spent with me discussing my problem, but all I want is to know if theres > something in Betwixt using which I can get this problem solved !!!! > > And I was still woundering and looking for answers to know if its the > java.util.List with which Betwixt is behaving funny or is there something > else I am missing or not doing right here ??? I think you have to do two things: * tweak the mapping (see below), and * add an additional method to User which is important for the mapping: public void addAuthorization(Authorization authorization) { authorizations.add(authorizations); } Now (assuming you're using betwixt 0.7) you have to tweak the mapping using an additional mapping.xml file: Now prior to reading/writing via betwixt you set this mapping: public Object readXML(Reader mappingReader, Reader xmlReader) throws IOException, SAXException, IntrospectionException { BeanReader beanReader =3D new BeanReader(); beanReader.registerMultiMapping(new InputSource(mappingReader)); return beanReader.parse(xmlReader); } public void writeXML(Reader mappingReader, Writer xmlWriter, Object obj) throws IOException, SAXException, IntrospectionException { xmlWriter.write("\n"); BeanWriter beanWriter =3D new BeanWriter(xmlWriter); beanWriter.getXMLIntrospector().register(new InputSource(mappingReader)); beanWriter.enablePrettyPrint(); beanWriter.write(obj); } where mappingReader is a Reader that retrieves the above mapping (eg. a FileReader or StringReader). Hope that helps, Tom ------=_Part_2297_16800971.1128358559552--