Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading xml file

 
imran quazi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you outputting this?
 
imran quazi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this very simmilar post, paying particular attention to what Thomas Murphy says about ther FileWriter class.
 
imran quazi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Thanks a lot. I'm checking with it.


Imran.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic