- From: Murray Altheim <murray@spyglass.com>
- Date: Fri, 26 Apr 1996 14:20:29 -0500
- To: David Ornstein <davido@objarts.com>
- Cc: www-html@w3.org, papresco@calum.csclub.uwaterloo.ca
David Ornstein <davido@objarts.com> writes: [discussion on marked sections as script containers...] >If you mean that it's a fair bit safer because ]] is less likely to occur in >the data, this seems like a case of closeness in horseshoes and hand >grenades. SGML doesn't give any useful help here with anything like an >escape character for the ']' does it? You show the example above having >been BinHex'd which is cheating a bit. If I wanted to, say, have a PERL >script in the marked section (roughly akin to the original intent in this >thread), what do I do if my script has a ']]' in it? (I do see your note >below about using an entity, but sometimes that wouldn't be done...) Well, I chose a bad example (a binhex document) but it did occur to me that since we're really talking here about scripts and not arbitrary data, the author has control (or at least knowledge) of the presence or absence of MSC (ie., ']]') in the embedded text. And yes, there is an SGML solution: rather than using a CDATA marked section, declare MSC as an entity literal and use an 'RCDATA' marked section. RCDATA (where the 'R' stands for replaceable) means that entity references are replaced upon being processed. Here's a convoluted example of an CDATA marked section embedded in an RCDATA marked section that would not be processed, but rather displayed: declare the entity &msc; in the declaration subset: <!DOCTYPE html PUBLIC "-//Spyglass//DTD HTML 2.0 Extended" [ <!ENTITY msc "]]"> ]> in document instance: <P>Here's an example of a CDATA marked section:</P> <PRE> <![ RCDATA [ <![ CDATA [ -- some CDATA content -- &msc;> ]]> </PRE> This would display as: Here's an example of a CDATA marked section: <![ CDATA [ -- some CDATA content -- ]]> Now, if we create a construct like: <SCRIPT SCRIPTENGINE="#perl"> <![ RCDATA [ -- some perl script -- ]]> </SCRIPT> The perl script could contain ']]' escaped as '&msc;'. Any other entities would be replaced here as well, which opens up some interesting possibilities... The biggest benefit here is that embedded content could have all sorts of syntactical constructs (which might be found in perl, Javascript, etc.) that would be illegal in SGML/HTML but within a marked section (apart from MSC) it's all fine. Any browser understanding marked sections could process this correctly. Note that the parsing requirements here are quite minimal compared to some proposals I've seen. Anyone interested in how marked sections work can check the "Gentle Introduction to SGML" at http://info.ox.ac.uk/~archive/teip3sg/SG17BIS.htm Paul had pointed out to me a better method of embedding non-SGML data (I don't disagree), but for purposes of this thread I think we've gotten a bit off track here. Murray ``````````````````````````````````````````````````````````````````````````````` Murray Altheim, Program Manager Spyglass, Inc., Cambridge, Massachusetts email: <mailto:murray@spyglass.com> http: <http://www.stonehand.com/murray/murray.html> "Give a monkey the tools and he'll eventually build a typewriter."
Received on Friday, 26 April 1996 14:19:38 UTC