Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Text file to XML

843834Dec 28 2004 — edited Dec 29 2004
Hey,

I'm quite new to XML and have the following problem at hand: I have a text file containing a 1000 numbers one below the other. I also have a XML file that has a 'Data' element somewhere in the file. Each 'Data' element would correspond to one number from the text file. I would like to programatically read each number from the text file and create 1000 'Data' elements in my XML file. I would then like to parse the XML file to obtain each number (I guess I'd have to use JAXP/SAX for this?)

The above procedure is just for testing purposes. Eventually, there will not be a text file but a stream of data points getting fed straight into the xml file (dunno how yet, but that's later). But, for testing purposes with a text file...is the above approach ok, or is there some better way to do this?

Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2005
Added on Dec 28 2004
2 comments
277 views