Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

use java to create XML Files

 
Dan Xu
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i wanna take loads of text files,and output the well-formed XML Files.
what should i do?
could anyone give me some links about this,any tutorials would be fine.
thanks!
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The safest choice from a wellformed-ness point of view would be to use the DOM API and JAXP for constructing the XML documents in-memory, and then serialize them into the text-based XML files you need as output.
Another option would be to write the XML output by hand using a java.io.FileWriter and a lot of write("<something>") statements. Easy (no need to learn the XML programming APIs), but unsafe (you're responsible for encoding special characters correctly, etc.).
 
Dan Xu
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.
and another problem i met at this moment is,how can i read in the .doc files using java.
i can read in text files now,but how about the .doc
because i have to take them in and then convert them to xml file as output.
[ April 21, 2004: Message edited by: Dan Xu ]
[ April 21, 2004: Message edited by: Dan Xu ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A simple google search for "read doc files with java" found this site.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic