Plz help me 2005-01-19 - By david kavanagh
Back Hi, This is the link I first sent (http://java.sun.com/xml/jaxb/index.jsp). If you look along the left side, there is a link for documentation. In short, you provide a schema for your XML structure. Run it through a tool provided with JAXB and java code is generated. Compile that and use JAXB (and those new classes) to parse your XML into the custom objects that represent your data. I played with this in the early access phase (when they were still using DTDs). and have been playing with XML parsing long before that. JAXB is the way to go if you want to avoid writing code to support your schema, but want random access to the data. If you want to pull things out quickly, SAX parsing is faster, but I'm sure with a little reading, you can get JAXB to work!
Good Luck!
David
On Thu, 20 Jan 2005 09:58:25 +0530, Raghavendra.Kopalle@(protected) <Raghavendra.Kopalle@(protected)> wrote: > Hi David, > > At first, Thanx a lot for the prompt response > > You said: "With JAXB, you can get an object that > specificly represents the note "customer-name". What are you looking > for?" > > Exactly something likes this, but unfortunately I am new to XML/JAXP, so > do you mind suggesting me a site and or sending me a code snippet which > does this. > > Thanx and Regards > > KR Kumar > > -- --Original Message-- -- > From: A mailing list for Java(tm) 2 Platform, Enterprise Edition > [mailto:J2EE-INTEREST@(protected)] On Behalf Of david kavanagh > Sent: Thursday, January 20, 2005 9:38 AM > To: J2EE-INTEREST@(protected) > Subject: Re: Plz help me > > ok, so how do you want to "address" that element? What model would you > like to use to get that data from that element? If you use DOM, you'll > get a generic data structure in memory, but you'll still need to look > for that element by name. > > David > > On Thu, 20 Jan 2005 09:33:49 +0530, > Raghavendra.Kopalle@(protected) > <Raghavendra.Kopalle@(protected)> wrote: > > David, > > > > Lets say I am extracting the an element from the XML the I don't want > > to say something like this > > > > Public void startElement(....){ > > If (qName.equals("customer-name")) { > > custBean.setCustomerName(qName)); > > } > > > > If you look at the above code I am hardcoding the customer-name > element > > which I don't want. > > > > Thanx and Regards > > > > KR Kumar > > > > -- --Original Message-- -- > > From: A mailing list for Java(tm) 2 Platform, Enterprise Edition > > [mailto:J2EE-INTEREST@(protected)] On Behalf Of david kavanagh > > Sent: Wednesday, January 19, 2005 7:30 PM > > To: J2EE-INTEREST@(protected) > > Subject: Re: Plz help me > > > > Well, it sounds like you just want it in a DOM tree, right? I mean, > > that is a generic representation of your XML. Is there something else > > I'm missing? JAXP will do this for you. > > > > David > > > > On Wed, 19 Jan 2005 09:20:00 +0530, KR Kumar > > <Raghavendra.Kopalle@(protected)> wrote: > > > No I still want to JAXP only. But I want are there generic design > > > patterns or means thru which I can address the issue. I mean I don't > > > want to hard code the element names during the processing of the XML > > > file in my code. > > > > > > -- --Original Message-- -- > > > From: A mailing list for Java(tm) 2 Platform, Enterprise Edition > > > [mailto:J2EE-INTEREST@(protected)] On Behalf Of Ranjeeth kumar > > > Sent: Tuesday, January 18, 2005 8:48 PM > > > To: J2EE-INTEREST@(protected) > > > Subject: Re: Plz help me > > > > > > are u completely ruling out the possibility of JAXB? > > > > > > -Ranjeeth > > > > > > On Tue, 18 Jan 2005 18:22:36 +0530, KR Kumar > > > <Raghavendra.Kopalle@(protected)> wrote: > > > > > > > > > > > > > > > > > > > > > > > > Hi guys, > > > > > > > > > > > > > > > > I have a medium size xml file which I need to read. I am using SAX > > > Parser > > > > for the same. Is there any generic way I can pull this data from > the > > > xml and > > > > put it in a VO. I don't want hardcore or use a constants class for > > > element > > > > names of the XML. Plz give me a code sample if its possible. > > > > > > > > > > > > > > > > Thanx & Regards > > > > KR Kumar > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > DISCLAIMER: > > > > This message contains privileged and confidential information and > is > > > > intended only for the individual named.If you are not the intended > > > recipient > > > > you should not disseminate,distribute,store,print, copy or deliver > > > this > > > > message.Please notify the sender immediately by e-mail if you have > > > received > > > > this e-mail by mistake and delete this e-mail from your > > system.E-mail > > > > transmission cannot be guaranteed to be secure or error-free as > > > information > > > > could be intercepted,corrupted,lost,destroyed,arrive late or > > > incomplete or > > > > contain viruses.The sender therefore does not accept liability for > > any > > > > errors or omissions in the contents of this message which arise as > a > > > result > > > > of e-mail transmission. If verification is required please request > a > > > > hard-copy version. > > > > > > > > > > ======================================================================== > > > === > > > > To unsubscribe, send email to listserv@(protected) and include in > > the > > > body > > > > of the message "signoff J2EE-INTEREST". For general help, send > email > > > to > > > > listserv@(protected) and include in the body of the message > "help". > > > > > > > > > > > > > > > > > > > > > > -- > > > ***************************** > > > Ranjeeth kumar, > > > SCEA > > > ************************************* > > > > > > > > > ======================================================================== > > > === > > > To unsubscribe, send email to listserv@(protected) and include in > the > > > body > > > of the message "signoff J2EE-INTEREST". For general help, send > email > > to > > > listserv@(protected) and include in the body of the message "help". > > > > > > DISCLAIMER: > > > This message contains privileged and confidential information and is > > intended only for the individual named.If you are not the intended > > recipient you should not disseminate,distribute,store,print, copy or > > deliver this message.Please notify the sender immediately by e-mail if > > you have received this e-mail by mistake and delete this e-mail from > > your system.E-mail transmission cannot be guaranteed to be secure or > > error-free as information could be > > intercepted,corrupted,lost,destroyed,arrive late or incomplete or > > contain viruses.The sender therefore does not accept liability for any > > errors or omissions in the contents of this message which arise as a > > result of e-mail transmission. If verification is required please > > request a hard-copy version. > > > > > > > > > ======================================================================== > > === > > > To unsubscribe, send email to listserv@(protected) and include in > the > > body > > > of the message "signoff J2EE-INTEREST". For general help, send > email > > to > > > listserv@(protected) and include in the body of the message "help". > > > > > > > > ======================================================================== > > === > > To unsubscribe, send email to listserv@(protected) and include in the > > body > > of the message "signoff J2EE-INTEREST". For general help, send email > to > > listserv@(protected) and include in the body of the message "help". > > > > DISCLAIMER: > > This message contains privileged and confidential information and is > intended only for the individual named.If you are not the intended > recipient you should not disseminate,distribute,store,print, copy or > deliver this message.Please notify the sender immediately by e-mail if > you have received this e-mail by mistake and delete this e-mail from > your system.E-mail transmission cannot be guaranteed to be secure or > error-free as information could be > intercepted,corrupted,lost,destroyed,arrive late or incomplete or > contain viruses.The sender therefore does not accept liability for any > errors or omissions in the contents of this message which arise as a > result of e-mail transmission. If verification is required please > request a hard-copy version. > > > > ======================================================================== > === > To unsubscribe, send email to listserv@(protected) and include in the > body > of the message "signoff J2EE-INTEREST". For general help, send email to > listserv@(protected) and include in the body of the message "help". > > DISCLAIMER: > This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted ,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. >
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
|
|