TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Margaret mentioned using CDATA as a way of inserting XML code into HTML without resorting to special
HTML characters. This is correct, but I think we need to know better what Moshe wants to do.
Does he want to just transfer the code sample exactly, without regard to how it is rendered by the browser, or does he want to display in a browser nicely formatted code samples that look just like they do in the code file itself?
If indeed the idea is just to pass unparsed information, then CDATA can do the trick most of the time.
If the idea is to show nicely formatted code samples (that retain the formatting they have in the code text file), then you've got to do something like use the <pre> tags to retain the formatting, and convert the angle brackets (and perhaps a few other things) to <, >, etc. If you look at the source of the page that Margaret referred to, you can see that this is the case. In order to show, in an HTML browser, the code they want to preserve by using CDATA, they use the <pre> tags and the translations of the characters. I guess the key thing here is that there is a difference between "showing the code sample" in an HTML browser, and "preserving" code in an HTML file.
As I mentioned in a previous post, I haven't found an easy, clean way to show code samples using just html tags and without translating some characters, but if someone does know of a way, I would also be interested in learning about it.
Paul
-----Original Message-----
From: techwr-l-bounces+paul -dot- inbar=intel -dot- com -at- lists -dot- techwr-l -dot- com [mailto:techwr-l-bounces+paul -dot- inbar=intel -dot- com -at- lists -dot- techwr-l -dot- com] On Behalf Of Margaret Hassall
Sent: Thursday, August 23, 2007 3:04 AM
To: Moshe Kruger (AllWrite); techwr-l -at- lists -dot- techwr-l -dot- com; Techshoret
Subject: RE: Inserting XML code into HTML source
-----Original Message-----
From:
techwr-l-bounces+margaret -dot- hassall=computershare -dot- com -dot- au -at- lists -dot- techwr-l -dot- co
m
[mailto:techwr-l-bounces+margaret -dot- hassall=computershare -dot- com -dot- au -at- lists -dot- tec
hwr-l.com] On Behalf Of Moshe Kruger (AllWrite)
Sent: Tuesday, 21 August 2007 9:47 PM
To: techwr-l -at- lists -dot- techwr-l -dot- com; Techshoret
Subject: Inserting XML code into HTML source
Hello all,
I am creating HTML pages with code samples in them.
Problem: How do I insert XML code into HTML without resorting to special
HTML characters (eg: < and >)?
I am using Dreamweaver. I have found I can put the code into the Design
window, of course, and then get the awful HTML code that results.
Anyone have a "cleaner" trick?
(Cross posted to techwr-l and techshoret)
--
---
This email and any files transmitted with it are solely intended for the use of the addressee(s) and may contain information that is confidential and privileged. If you receive this email in error, please advise us by return email immediately. Please also disregard the contents of the email, delete it and destroy any copies immediately.
Computershare Limited and its subsidiaries do not accept liability for the views expressed in the email or for the consequences of any computer viruses that may be transmitted with this email.
This email is also subject to copyright. No part of it should be reproduced, adapted or transmitted without the written consent of the copyright owner.
Create HTML or Microsoft Word content and convert to Help file formats or
printed documentation. Features include support for Windows Vista & 2007
Microsoft Office, team authoring, plus more. http://www.DocToHelp.com/TechwrlList
True single source, conditional content, PDF export, modular help.
Help & Manual is the most powerful authoring tool for technical
documentation. Boost your productivity! http://www.helpandmanual.com
---
You are currently subscribed to TECHWR-L as paul -dot- inbar -at- intel -dot- com -dot-
To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com
Send administrative questions to admin -at- techwr-l -dot- com -dot- Visit http://www.techwr-l.com/ for more resources and info.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create HTML or Microsoft Word content and convert to Help file formats or
printed documentation. Features include support for Windows Vista & 2007
Microsoft Office, team authoring, plus more. http://www.DocToHelp.com/TechwrlList
True single source, conditional content, PDF export, modular help.
Help & Manual is the most powerful authoring tool for technical
documentation. Boost your productivity! http://www.helpandmanual.com
---
You are currently subscribed to TECHWR-L as archive -at- web -dot- techwr-l -dot- com -dot-