Thanks.
Werner Guttmann wrote: > > If there's just an Instrument class on the Java side of things, you will > have to go with a mapping file. Have a look at the location attribute as > described on the HTML documentation to see how to (possibly) go about > this. > > In addition, please feel free to read Brett McLaughlin's article series > on Castor (available at IBM developerWorks) as well, as many concepts > are being discussed there in detail. > > Regards > Werner > > poijava wrote: >> No, I only have an Instrument object. Ultimately what I would like is to >> obtain an ArrayList of instrument objects. The XML is below. Do you know >> how >> I can achieve this? >> >> <ins> >> <instrument> >> <date>04-Feb-2008</date> >> <bbg>Instrument 1</bbg> >> <sedol>5499131</sedol> >> <isin>IT0001233417</isin> >> <bookqty></bookqty> >> </instrument> >> <instrument> >> <date>04-Feb-2008</date> >> <bbg>Instrument 2</bbg> >> <sedol>5499131</sedol> >> <isin>IT0001233417</isin> >> <bookqty></bookqty> >> </instrument> >> >> </ins> >> >> >> 建坛林 wrote: >>> Is there any object associated with the element "ins"? >>> if there is no set method for a attribute in a certain object to be >>> unmarshalled to , the unmarshalled element result can be null. >>> >>> 2008/4/7, poijava <[EMAIL PROTECTED]>: >>>> >>>> Hi, >>>> >>>> I am trying to unmarshall an XML document below: >>>> >>>> <?xml version="1.0" encoding="UTF-8"?> >>>> <instrument> >>>> <date>04-Feb-2008</date> >>>> <bbg>A2A IM Equity</bbg> >>>> <sedol>5499131</sedol> >>>> <isin>IT0001233417</isin> >>>> <bookqty></bookqty> >>>> </instrument> >>>> >>>> Using the following code: >>>> >>>> Instrument instrument = (Instrument) Unmarshaller.unmarshal( >>>> Instrument.class, new FileReader("Instrument.xml")); >>>> >>>> System.out.println(instrument.getBbg()); >>>> >>>> this works fine except when I have a root element e.g. >>>> >>>> <?xml version="1.0" encoding="UTF-8"?> >>>> <ins> >>>> <instrument> >>>> <date>04-Feb-2008</date> >>>> <bbg>A2A IM Equity</bbg> >>>> <sedol>5499131</sedol> >>>> <isin>IT0001233417</isin> >>>> <bookqty></bookqty> >>>> </instrument> >>>> </ins> >>>> >>>> The all the fileds in my Instrument object are null!! >>>> >>>> Can anyone please help? >>>> >>>> Thanks, >>>> G >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Unmarshalling-Root-node-problem-tp16537521p16537521.html >>>> Sent from the Castor - Dev mailing list archive at Nabble.com. >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe from this list, please visit: >>>> >>>> http://xircles.codehaus.org/manage_email >>>> >>>> >>>> >>> >> > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > -- View this message in context: http://www.nabble.com/Unmarshalling-Root-node-problem-tp16537521p16561777.html Sent from the Castor - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email