jQuery in Action, 2nd edition*
The moose likes I/O and Streams and the fly likes Problem with reading file from disk into XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Problem with reading file from disk into XML" Watch "Problem with reading file from disk into XML" New topic

Problem with reading file from disk into XML

Cathy Chlevner

Joined: Aug 24, 2008
Posts: 13
I need to read some files from disk, as XML, then make a string of each of them and [using a queue to keep all the strings ] send via HTTP to the client per it's request.
If I use apache-commons-io.FileUtils.fileAsString - I get some characters not ending up the same in the result, so it looks like encoding problem which I don't know how to solve.

If I use XMLEventReader/Writer so as to treat the file as xml, read it by events etc, and then make a string out of it, then queue ets, the client can't read the XML at all ...

Please help -as this does feel like voodoo right now ..

Problem solved -indeed encoding issue, which is easy as pie to handle in FileUtils -just provided the relevant encoding as param to the method.

"Laziness is nothing more than the habit of resting before you get tired." - Jules Renard
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with reading file from disk into XML
Similar Threads
need help on posting xml over http
Regarding XML Messages in JMS
Problem Whit Special Characters on server side
<Generics> Is this a good use of Java Generics?! UPDATED: Another question included.
How can i transform a unicode String into a japanese String??