Shaun Mccran

My digital playground

30
J
U
L
2009

Displaying raw html onscreen using the Example html tag

Ever needed to display an example block of HTML code in a web based document or regular web page?

I had just that requirement recently, so thought I'd have a dig around. It is one of the smallest html tags I've found, it is the example tag.

view plain print about
1<xmp> html code</xmp>

It works very much like the 'pre' tag in the way that it displays whatever it contains without any sort of formatting, in its raw state. Except that this also display html, rather than interpreting it, it displays it exactly as is.

Nothing revolutionary, but a nice surprise and handy for code samples etc.

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Eric Hynds's Gravatar I think that tag has been deprecated in favor of pre. It's an old html 3 tag, and results will probably be inconsistent between browsers..
# Posted By Eric Hynds | 30/07/2009 15:37
Chris Tierney's Gravatar I almost thought you had something good here, as this would be useful. However the xmp tag is depreciated.

From W3C: These are obsolete tags for preformatted text that predate the introduction of PRE. User agents may support these for backwards compatibility. Authors should avoid using them in new documents!
# Posted By Chris Tierney | 30/07/2009 15:37
Shaun McCran's Gravatar Yes, I'd read that it was deprecated, but after testing it on 3 IE versions, firefox and safari I couldn't get it to error, so I thought I'd use it.

I'll probably write a CFC or UDF for it in the long run if I find I have the need. Or could probably extract whatever method Ray has written in Blogcfc for the < code > blocks.
# Posted By Shaun McCran | 30/07/2009 15:48
todd sharp's Gravatar How about htmlEditFormat()?
# Posted By todd sharp | 30/07/2009 15:51
Shaun McCran's Gravatar Yes, you could use those, tried a test with htmlEditFormat and htmlCodeFormat, only difference seems to be the wrapping of the content in a < pre > tag.

<cfsavecontent variable="variables.content">
<InvalidTag language="JavaScript" type="text/javascript">
<!--
var google_conversion_id = 132456789;
var google_conversion_language = "en_GB";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "sfsdjldsfslkjsdf";
//-->
</script>
</cfsavecontent>

<cfoutput>
#HTMLCodeFormat(variables.content)#

#HTMLEditFormat(variables.content)#
</cfoutput>

Read somewhere that they can pad the content, but for display purposes that doesn't really matter.
# Posted By Shaun McCran | 30/07/2009 16:32
todd sharp's Gravatar I also blogged last week about a JavaScript equivalent to htmlEditFormat() if you ever need it:

http://cfsilence.com/blog/client/index.cfm/2009/7/...
# Posted By todd sharp | 30/07/2009 16:49
John G. Johnson's Gravatar Different material is used to build a boat and today we see big ships in built with metals instead of woods. I think wooden boat has more nature friendly environment as compare to any metallic boat so many respect from my side. Just employ our research paper writing service by taking EssayState.com review http://www.topwritersreview.com/reviews/essaystate... where professionals are available all time for your help.
# Posted By John G. Johnson | 20/08/2014 23:42
Kizi's Gravatar Good post. Thank you for sharing this article. Very intersting.
# Posted By Kizi | 30/09/2014 21:26
Frive's Gravatar Thank you for sharing information. I like it.
# Posted By Frive | 01/04/2015 08:07
Kizi 2015's Gravatar Very interesting, I've spent a lot of time to read and think about it, thanks for your ideas.

<a href="http://wpshesviralpro.net"; title="WP She’s Viral Pro">WP She’s Viral Pro</a> |
<a href="http://www.kizi2015games.org"; title="Kizi 2015">Kizi 2015</a> |
<a href="http://www.juegos2015.org"; title="Juegos 2015">Juegos 2015</a>
# Posted By Kizi 2015 | 07/04/2015 09:41
Jodie McLean's Gravatar I was really impressed. This is really interesting topic, I'll write a paper on it or probably I'll just buy essay . Thank you very much!
http://wpshesviralpro.net
http://www.kizi2015games.org
http://www.juegos2015.org
# Posted By Jodie McLean | 07/04/2015 09:47
Kizi 4's Gravatar HI. I found a lot of information here to create this actually best for all newbie here. Thank you for this information.
# Posted By Kizi 4 | 15/04/2015 00:44
Kizi 9's Gravatar all what you presented here and I've read that it is good for my work everything makes me happy,thanks.
# Posted By Kizi 9 | 15/04/2015 00:45
Kizi 8's Gravatar Very interesting, I've spent a lot of time to read and think about it, thanks for your ideas.
# Posted By Kizi 8 | 17/04/2015 00:05
# Posted By kizi6 | 17/04/2015 00:06
http://www.frivefriv.com's Gravatar I'm happy about everything you bring it very interesting and helpful, thanks
# Posted By http://www.frivefriv.com | 19/04/2015 06:59
Jodie Bishop's Gravatar I was really impressed. This is really interesting topic, I'll write a paper on it.
# Posted By Jodie Bishop | 21/04/2015 03:44
Joe Sanderson's Gravatar Very interesting, I've spent a lot of time to read and think about it, thanks for your ideas.
http://www.firvfriv.com
http://www.kizi2015games.org
http://www.friv2015juegos.com
# Posted By Joe Sanderson | 13/05/2015 08:31
Yoob's Gravatar Yoob.net update new-best free games online from internet. Play free action games, free addicting games, puzzle games, sports games, girls games and adventure games online. ..and more. Visit and play funny games at Yoob.net.
# Posted By Yoob | 04/06/2015 03:46
Henry Watson's Gravatar Thanks for sharing.
https://www.appforpcshub.com/
# Posted By Henry Watson | 16/06/2015 23:54
friv4's Gravatar I would like more information about this, because it is very nice., Thanks for sharing.
play games http://www.games2girls2.com/ download http://www.baixarfacebookmovel.com/
# Posted By friv4 | 24/06/2015 20:38
ozov games's Gravatar <a href="http://www.ozovgames.net//">ozov games</a> OzovGames.net is directory flash games online: action games, shooting games, racing games and dress up girls games. We add new games daily for you to play for free!
# Posted By ozov games | 11/08/2015 04:47
http://awriter.org's Gravatar Wow, I'm a lefty too and i dont know if all that it true but still WOW! <a href="http://awriter.org">online essay writer</a>
i never knew all those ppl wer leftys cuz i aint american so yea. but still, nice work n u shudna put the jealousy part.... just sayin......
# Posted By http://awriter.org | 10/10/2015 10:02
http://awriter.org's Gravatar I really like your modern stylish ideas which you have shared about manipulative. This blog provide extraordinary and exact information for which I was searching.[url=http://awriter.org] online essay writer [/url]
http://awriter.org
http://awriter.org
http://awriter.org
# Posted By http://awriter.org | 10/10/2015 10:02
http://topassignmentwriters.com's Gravatar At the very 1st, I’d favor to state thanks to you for this enlightening article. Second, I'd prefer to wonder wherever I can learn a lot more info concerning your post. I arrived right here via Bing and can't discover any associated web websites connected to this matter. How do I sign for your web blog? I had prefer to stick to your updates as they arrive along! I'd a query to interrogate but I forgot what it absolutely was... anyways, thank you very much.[url=http://topassignmentwriters.com] assignment help australia [/url]
http://topassignmentwriters.com
http://topassignmentwriters.com
http://topassignmentwriters.com
# Posted By http://topassignmentwriters.com | 10/10/2015 10:04
Ryan's Gravatar Thanks for sharing this awesome piece of content.
# Posted By Ryan | 16/10/2015 10:57
Asifshaikh's Gravatar nice post check out my website http://www.digilogi.org/
# Posted By Asifshaikh | 05/11/2015 21:46
Friv 1000's Gravatar Update new-best free Cartoon Games online from internet. Toon Games is a free online cartoon flash games site where you can find games from all your favorite cartoons such as Ben10, Dora, Tom and Jerry, Spongebob and many more. http://kizi1000.in , http://toongames.in, http://friv1000.link
# Posted By Friv 1000 | 07/11/2015 18:05
Pou Games's Gravatar New <a href="http://kizi1000.in/">Kizi</a>;, <a href="http://pou-games.net/">Pou Games</a> experience for each of your emotions. Thrilling, vibrations of love, adventure adventurous or want to destroy all ... are transformed into this game:
<a href="http://mariogames.name/">Mario Games</a> | <a href="http://friv1000.link/">Friv 1000</a> | <a href="http://doraemongamesplay.com/">Doraemon Games</a>
# Posted By Pou Games | 10/11/2015 18:27
Kizi 1's Gravatar Top Games is a great place to play the best free online Kizi games, juegos Kizi, jogos Kizi, jeux de Kizi from the top game developers all over the world. Play free online at <a href="http://kizi1000.in/">Kizi</a>; , <a href="htt
# Posted By Kizi 1 | 11/11/2015 02:05
k7x games's Gravatar Thanks for provide us these unique guidelines it's really helpful for everyone. This is very interesting and too informative.
# Posted By k7x games | 15/12/2015 01:56
y8 games's Gravatar Really I appreciate the effort You made to share .The topic here I found was really effective to the topic which I was researching for a long time.
# Posted By y8 games | 15/12/2015 01:57
yoo games's Gravatar Thank you for another wonferdul article. Where else could anyone get that kind of information in such an ideal way of writing? I have a presentation next week, and I am on the look for such information.
# Posted By yoo games | 19/12/2015 01:13
abcya's Gravatar I love all the posts, I really enjoyed, I would like more information about this, Thanks for sharing
http://abcya4.com
http://minecraftgames.info
# Posted By abcya | 24/12/2015 19:04
friv's Gravatar When your free time, what are you offen do? With me, can listen to music, watch Film or play games online if have SmartPhone. Visit page!
# Posted By friv | 29/12/2015 18:55
Back to top