aspose file tools*
The moose likes Java in General and the fly likes reading xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "reading xml file" Watch "reading xml file" New topic
Author

reading xml file

imran quazi
Greenhorn

Joined: Dec 01, 2006
Posts: 18
Hi All,

i'm trying to read an xml file with special character in it. but the output is not showing those special characters. can anybody help me in this matter?

Regards
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

How are you outputting this?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
imran quazi
Greenhorn

Joined: Dec 01, 2006
Posts: 18
Hi,

I'm writing here the following codes...but still i'm not able to encode and decode the special characters like opening & closing quotation(curly, not the usual type)...

===================================================

FileReader fr = new FileReader("D:/original/br11.xml");

FileWriter f0 = new FileWriter("D:/original/xyz.xml");

BufferedReader br = new BufferedReader(fr);
while((s = br.readLine()) != null) {

System.out.println(s.trim());

String encoded_text = URLUTF8Encoder.encode(s);
System.out.println(encoded_text);
String finalDecoded=unescape(encoded_text);
System.out.println(finalDecoded);
f0.write(finalDecoded);
f0.write(s);
f0.write("\n");
}
fr.close();
f0.close();
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have a look at this very simmilar post, paying particular attention to what Thomas Murphy says about ther FileWriter class.
imran quazi
Greenhorn

Joined: Dec 01, 2006
Posts: 18
Hi Paul,

Thanks a lot. I'm checking with it.


Imran.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reading xml file
 
Similar Threads
special characters
Bean in EJB3
Tomcat gets crazy...
Compile/process XML ?
XML parser