Re: how to create a MultiLine string



Thomas 'PointedEars' Lahn wrote:
Peter Michaux wrote:
On Aug 24, 12:23 am, Douglas Crockford wrote:
<snip>
var html = "<html>" +
"<body>" +
"<\/body>" +
"<\/html>";

Why escape the '/' on the closing tags? I have only read
that is necessary for script tags.

Your information is inaccurate.

Probably more superficial than inaccurate. To date there have been no
reports of an browsers that actually terminated CDATA SCRIPT element
contents just on the first occurrence of ETAGO, they seem to all wait
for ETAGO followed by (case folded) 'SCRIPT'. But, as usual, a failure
to observe (or observe and report) is not an indicator of the
non-existence of the thing that has not been observed. There may be, in
the past, currently or in the future, a browser that does behave
precisely as described in the HTML 4 specifications and will terminate
CDATA at the very first ETAGO, and HTML authors have no justification
for being surprised when/if that does happen.

CDATA content ends at an ETAGO delimiter,
no matter the element.

http://www.w3.org/TR/html4/types.html#type-cdata

That would be in HTML, according to the HTML speciation. The SGML
specification seems to have a different attitude, where it says (ISO
8879, Appendix B.13.1.1):-

| If an element contains declared character data, it cannot
| contain anything else. The markup parser scans it only to
| locate an ETAGO or NET; other markup is ignored. Only the
| correct end-tag (or that of an element in which this element
| is nested) will be recognised.

- which says that although the parser is looking for ETAGO it is only
interested in them if they start the "correct end-tag", or the end-tag
of a containing element. Given that the closing SCRIPT tag is not
optional (in HTML) it could be suggests that a hypothetical SGML parser
would skip '</'s until it found </script>. On the other hand it may be
that if the opening script was in, say, the HEAD the character sequence
'</head>' might be taken as "that of an element in which this element is
nested" and used to terminate the CDATA.

On the whole it has got to be safest to break up all occurrences of
ETAGO inside CDATA in HTML documents, and so satisfy all interpretations
of all applicable documents.

(It is also worth noting that ISO 8879 Appendix B is explanatory text
not reference.)

Do HTML parsers exist that have a problem with those
closing tags

Yes, the W3C Validator's SGML parser being one of them.

or are you just being conservative?

Maybe that as well.

There is no harm in being conservative here.

It is not necessary to escape ETAGOs if they do not
occur within `script' element CDATA content.

Aren't they just as potentially problematic in any other element's CDATA
contents (STYLE?)

So the said snippet has the
best chance to work everywhere.

I find it a easier to use single quotes when quoting HTML
because then attribute double quotes don't need escaping.

"<li id=\"foo\">"
'<li id="foo">'

Add me.
<snip>

As do I, but not for that reason. It is a habit I acquired writing JSP,
where javascript and Java may appear together. I wanted the two to be as
visual distinct as possible (even though the syntax highlighting rules
for JSP apply the same rules to all code seen) and given that Java
string literals must be delimited with double quotes using single quotes
with javascript meant that if chunks of code contained sequences of text
characters in one color they were Java, and another color meant
javascript. A very immediate indicator of which code context you are
looking at in a JSP.

<snip>
(Unfortunately, the SGML spec is not available free
of charge at ISO.)
<snip>

Anyone considering paying for a copy of an ISO specification would be
well advised to get their copy in electronic form. Although I much
prefer reading documents from paper (rather than a computer screen) the
quality of the ISO printed documents is not particularly good (read
'quite bad', even (ironically for the ISO) 'substandard') and it would
not take much work to achieve a superior hard copy from a printout of
the electronic version.

Richard.

.



Relevant Pages

  • Validating to a higher 4.01 standard (long)
    ... The next step is to copy these HTML documents to a new directory (so you do ... onmousedown %Script; #IMPLIED ... datafld CDATA #IMPLIED ... href %URI; #IMPLIED ...
    (alt.html)
  • Re: burning DVD failure
    ... Alex, I appreciate your help and information very much. ... I sussessfully burned that iso image with Nero 7 on ... with the script I posted. ...
    (microsoft.public.scripting.vbscript)
  • [SLE] Converting 9.3 CD ISOs to a DVD ISO
    ... I attach the script I got from a friend for converting the five ... downloadable CD ISO images to a single DVD ISO image. ... mount SUSE-9.3-Prof-i386-CD2.iso CD2 -o loop ...
    (SuSE)
  • Re: burning DVD failure
    ... I sussessfully burned that iso image with Nero 7 on ... not as much as 2.65 Gbs that could be expected from the source iso file. ... > with the script I posted. ... > I do have a brand new DELL T7400 quad with 4Gbs of RAM. ...
    (microsoft.public.scripting.vbscript)
  • Re: [opensuse] Mount ISO as user
    ... I have this script, Kai, it works rather well for me. ... 1)Kai wanted something that could mount an ISO from the GUI ... ...
    (SuSE)