Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 79056 invoked from network); 18 Aug 2004 14:15:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 18 Aug 2004 14:15:40 -0000 Received: (qmail 51797 invoked by uid 500); 18 Aug 2004 14:15:25 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 51701 invoked by uid 500); 18 Aug 2004 14:15:23 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: 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 51676 invoked by uid 99); 18 Aug 2004 14:15:23 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [62.138.2.165] (HELO mail1.highwayone.de) (62.138.2.165) by apache.org (qpsmtpd/0.27.1) with SMTP; Wed, 18 Aug 2004 07:15:17 -0700 Received: (qmail 15696 invoked from network); 18 Aug 2004 14:15:15 -0000 Received: from unknown (HELO hestia) ([212.94.229.2]) (envelope-sender ) by mail1.highwayone.de (qmail-ldap-1.03) with SMTP for ; 18 Aug 2004 14:15:15 -0000 Reply-To: From: "Birgit Linner" To: "Jakarta Commons Users List" Subject: AW: [betwixt] mapID Problems Date: Wed, 18 Aug 2004 16:14:05 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 In-Reply-To: <8D39E309-F092-11D8-BD71-003065DC754C@blueyonder.co.uk> Importance: Normal X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi Robert! Thank you for answering! I really don't want to use digester rules ;-) But if I do not, I don't get the ArrayLists back from BeanReader. The output shows, that the content is read, but I get nothing back... only if I add digester rules. Looks like otherwise the objects are "hanging in the air".. Can the digester rules be the reason, why references are null and ids=0? Thanks and a nice evening! Birgit -----Ursprungliche Nachricht----- Von: robert burrell donkin [mailto:robertburrelldonkin@blueyonder.co.uk] Gesendet: Dienstag, 17. August 2004 23:15 An: Jakarta Commons Users List Betreff: Re: [betwixt] mapID Problems hi Birgit though you can mix digester rules with betwixt, this is an advanced topic. i'd suggest that you'd be better letting betwixt do the whole of your mapping initially. if you want to vary your mapping of beans into elements, i'd suggest reading up on dot betwixt files. - robert On 17 Aug 2004, at 10:13, Birgit Linner wrote: > Hi everybody! > > I`m new to betwixt and want to use it to dump and import our database > tables. > Dumping is ok, altough I have some questions, too. > The problem is, that every reference to other objects is null when I > read > the XML file. > ( I have defined: > beanReader.getBindingConfiguration().setMapIDs(true); ) > > > > I have the following structure in the XML File: > > > ----------------------- dump.xml ---------------------------------- > > > > ... > > ... > > > --> Reference to Person > > > --------------------------------------------------------------------- > > > > I am reading the XML file with this Reader (btw: I`m also new to > Digester > and tried a bit to get the ArrayList structure out of the file, I got > no > result when only using beanReader.registerBeanClass(...) ): > > > > -------------------- Dumper.java ------------------------------------ > StringReader xmlReader = new StringReader("dump.xml"); > BeanReader beanReader = new BeanReader(); > beanReader.getXMLIntrospector().setWrapCollectionsInElement(false); > beanReader.getXMLIntrospector().setAttributesForPrimitives(true); > beanReader.getBindingConfiguration().setMapIDs(true); > beanReader.registerBeanClass("ArrayList", ArrayList.class); > beanReader.addObjectCreate("ArrayList/ArrayList", ArrayList.class); > beanReader.addSetNext("ArrayList/ArrayList", "add"); > beanReader.registerBeanClass("ArrayList/ArrayList/Person", > Person.class); > beanReader.addSetNext("ArrayList/ArrayList/Person", "add"); > beanReader.registerBeanClass("ArrayList/ArrayList/Role", Role.class); > beanReader.addSetNext("ArrayList/ArrayList/Role", "add"); > beanReader.registerBeanClass("ArrayList/ArrayList/Arbeitszeit", > Arbeitszeit.class); > beanReader.addSetNext("ArrayList/ArrayList/Arbeitszeit", "add"); > beanReader.registerBeanClass("ArrayList/ArrayList/Projekt", > Projekt.class); > beanReader.addSetNext("ArrayList/ArrayList/Projekt", "add"); > Object result = beanReader.parse(new File("dump.xml")); > ----------------------------------------------------------------------- > - > > > With this configuration I get an ArrayList with ArrayLists.. and so on, > but - how mentioned above - the idref is null: > > > ---------------------- OUTPUT ----------------------------------------- > Projekt: > id ="0" > manager=null > name ="Projekt1" > ----------------------------------------------------------------------- > > Is there anything I forgot? Or am I doing something wrong? I`d really > appreciate a tip! > > > Another question about wrinting a bean to XML: > I`d like to rename my ArrayLists (only for better reading), e.g. the > root-ArrayList to "Data" and the inner ones to "persons", "project" > etc. > Is this possible? I tried, but always get empty tags (also with using > class-property in element-tag). But this is only "nice to have"... > > Thanks in advance! > > Have a nice day! > > Birgit > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org