File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing &

 
Carl Parrish
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how to print the '&' (or & on a JSP page from a XML stream? Sorry I don't have access to the code right now but what I think they did was pull the string as text then marked it up in XML then used xslt to transform it on the JSP page and display it to print. Everything looks okay except they couldn't come up with a way to escape the '&' char. I've been looking on xml sites but can't seem to find this.
Carl P.
 
Praveen Kumar Jha
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In XML stream, you can wrap the text with CDATA.
e.g. <!CDATA[yourdata&andwhatever]]
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Carl Parrish:
Can anyone tell me how to print the '&' (or & on a JSP page from a XML stream? Sorry I don't have access to the code right now but what I think they did was pull the string as text then marked it up in XML then used xslt to transform it on the JSP page and display it to print. Everything looks okay except they couldn't come up with a way to escape the '&' char. I've been looking on xml sites but can't seem to find this.
Carl P.

Unless I'm misunderstanding, you can 'escape' & as &. If you're printing out XML from a JSP page, you can use the <c ut> and <x ut> tags of JSTL (the JSP Standard Tag Library), which by default automatically escape XML metacharacters like '&' for you.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic