Re: [xml-dev] Is it possible to include JavaScript...in an XML file...?
by Joe English other posts by this author
Sep 23 2002 10:09PM messages near this date
[PMX:##] [xml-dev] Is it possible to include JavaScript...in an XML file...?
|
[xml-dev] "The serialization of the XML Infoset is XML" (WAS: [x
ml-dev] Underwhelmed (WAS: [xml-dev] XOM micro tutorial))
tariq abdur-rahim wrote:
> Quicc question...Is it possible to include JavaScript "source code" in an XML
> file and have it displayed as parsed data as opposed to it trying to perform
> a function?
Heh.
Yes. In fact, that's the default behaviour: data in
an XML document doesn't _do_ anything on its own
until some process interprets it.
Also, you may find the <![CDATA[ ... ]]> construct helpful.
Inside a CDATA section, you don't have to escape &, <, or > ,
so you can basically copy-and-paste whatever you want
as long as it doesn't contain the closing delimiter "]]> ".
Quoting <URL: http://www.flightlab.com/~joe/sgml/faq-not.txt> ,
section 3, question 2:
| Q. How do I include JavaScript inside an XML document?
|
| A. Easy! Just write:
|
| <code notation="JavaScript"> <![CDATA[
| ... your JavaScript code goes here ...
| ... make sure it doesn't contain the sequence "]]> "...
| ]]>
| </code>
This is the first time I've ever heard anyone ask that question
who was expecting that answer though...
--Joe English
jenglish@[...].com
-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org> , an
initiative of OASIS <http://www.oasis-open.org>
The list archives are at http://lists.xml.org/archives/xml-dev/
To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>
Thread:
tariq abdur-rahim
Joe English
|