• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Escaping special character

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to do create a simple String Buffer and my jsp page is failing. Here is what I am trying to do.
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> ;
When I do <%= sb.toString() %> it returns nothing. If I do \< then I get invalid escape character error message. How can I fix the situation. I need to create an XML page from my JSP page.
Thank you
-- amar
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you set the content type of the page to be text/xml?
[ August 28, 2002: Message edited by: Chris Mathews ]
 
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't use a single-quote (') instead of the double-quote (") ? Single-quote does'nt need escaping
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would change it as:
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\'1.0\'encoding=\'UTF-8\' "?>
reply
    Bookmark Topic Watch Topic
  • New Topic