Thats the right output for the way you have it set up. Since items are essentially are a part of the order, it gets nested. In order have them non-nested you would have to write a mapping file. But wouldn't that be a weird XML doc with to different main root tags, order and item?
-Nick On 5/20/05, vanniarajan arumugam <[EMAIL PROTECTED]> wrote: > Hello, > > I am new to Castor. > > I tried to test the example given in > > http://castor.codehaus.org/xml-mapping.html > > <?xml version="1.0" encoding="UTF-8"?> > <Order reference="12343-AHSHE-314159" > total-price="0.0"> > <Client> > <Name>test client</Name> > <Address>test drive</Address> > </Client> > <item> > <item > reference="test"><Quantity>1</Quantity><UnitPrice>1.0</UnitPrice><Description>test</Description> > </item> > </item> > </Order> > > My issue is .. I was expecting item element to appear > under Order ..but item is nested inside item.. Please > let me know where did I make the mistake > > > I tried to create the Order as shown below > > MyOrder order = new MyOrder(); > order.setReference("12343-AHSHE-314159"); > ClientData clientData = new ClientData(); > > clientData.setAddress("test drive"); > clientData.setName("test client"); > > order.setClientData(clientData); > > Vector itemVector = new Vector(); > > Item tempItem = new Item(); > > tempItem.set_description("test"); > tempItem.set_reference("test"); > tempItem.set_quantity(1); > tempItem.set_unitPrice(1.00f); > > itemVector.addElement(tempItem); > > order.setItemsList(itemVector); > > // 4. marshal the data with the total > price back and print the XML in the console > Marshaller marshaller = new Marshaller(new > OutputStreamWriter(System.out)); > marshaller.setMapping(mapping); > marshaller.marshal(order); > > Your help is highly appreciated! > Raj > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------