RE: Inserting XML code into HTML source

Subject: RE: Inserting XML code into HTML source
From: "Inbar, Paul" <paul -dot- inbar -at- intel -dot- com>
To: "Margaret Hassall" <Margaret -dot- Hassall -at- computershare -dot- com -dot- au>, "Moshe Kruger \(AllWrite\)" <moshe -dot- kruger -at- gmail -dot- com>, <techwr-l -at- lists -dot- techwr-l -dot- com>, "Techshoret" <techshoret -at- yahoogroups -dot- com>
Date: Thu, 23 Aug 2007 10:07:35 +0300

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 &lt;, &gt;, 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

You can use "cdata"

Have a look at the W3 schools:
http://www.w3schools.com/xml/xml_cdata.asp

Margaret

-----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: &lt; and &gt;)?

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 unsubscribe send a blank email to
techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
or visit http://lists.techwr-l.com/mailman/options/techwr-l/paul.inbar%40intel.com


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-

To unsubscribe send a blank email to
techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
or visit http://lists.techwr-l.com/mailman/options/techwr-l/archive%40web.techwr-l.com


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.


References:
RE: Inserting XML code into HTML source: From: Margaret Hassall

Previous by Author: RE: Inserting XML code into HTML source
Next by Author: Re: RE: Six elementary rules for writing good english
Previous by Thread: RE: Inserting XML code into HTML source
Next by Thread: DocBooks question


What this post helpful? Share it with friends and colleagues:


Sponsored Ads