OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Is it possible to include JavaScript...in an XML file...?

[ Lists Home | Date Index | Thread Index ]


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@flightlab.com




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS