Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Help for Data Binding between Java & XML

  Asked By: Ella    Date: Oct 28    Category: Java    Views: 943
  

I have to complete a task where i
have to take some numbers from xml as an input and must do
calculation in java and must produce it back as in an another xml
file.
Please help me, Since i couldnt get required information in the net.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Taylor Evans     Answered On: Oct 28

> have to take some numbers  from xml  as an input  and
> must do
> calculation in java  and must produce it back  as in
> an another xml
> file.

You can use the classes and methods in Apache Xalan
(freely downloadable) or in Saxon to do this.
To read the xml file you can use the SaxReader and to
write an xml output, you can either use java.io or
DomWriter class.

> Please help  me, Since i couldnt get required
information  in the net.

The documentation for both these is available as API
and is freely downloadable.

You *will* have to read a bit about XML and the
methods in Sax and Dom before you can attempt this.

 
Answer #2    Answered By: Benjamin Simpson     Answered On: Oct 28

Instead of using Xalan, Xerces or something else directly you should use
JAXP.
This is a common interface and set of APIs for working with XML. Go to sun
and read about JAXP.

 
Answer #3    Answered By: Adalwen Fischer     Answered On: Oct 28

I think the best approach for xml  based binding  is JAXB. Using JAXB, u can
perform marshalling and unmarshalling of data  in XML files. so u can use JAXB
api's and convert xml file data into java  classes instances (marshalling), then
do whatever u wanna do with it and finally convert java class instances into xml
files(unmarshalling). I know SAX, DOM, JAXP all work to this.. but beleive me,
nothing is simpler than JAXB.

 
Didn't find what you were looking for? Find more on Help for Data Binding between Java & XML Or get search suggestion and latest updates.




Tagged: