ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-dev
xml-dev
[PMX:##] [xml-dev] Is it possible to include JavaScript...in an XML file...?
by tariq abdur-rahim other posts by this author
Sep 23 2002 9:19PM messages near this date
[xml-dev] Re: Why Are Inner and Outer Unclean? (WAS RE: [xml-dev] Underwhelmed (WAS: [xml-dev] XOM micro tutorial)) | Re: [xml-dev] Is it possible to include JavaScript...in an XML file...?
Hey all:

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?  

For example:

Is possible to include the following...

-- Code Snippet. --

&#lt;script language="JavaScript" type="text/JavaScript"&#gt;<br /> <br />

document.write<br /> 

("&#lt;p class='10'&#gt;&#lt;strong&#gt;Document Purpose:&#lt;/strong&#gt; Used to create a 
CommentNode in XML Tree document.")<br /> 

document.write<br /> 

("&#lt;br /&#gt;&#lt;strong&#gt;Language(s):&#lt;/strong&#gt; XML, JavaScript, vbScript")<br
 /> <br />

&#lt;/script&#gt;<br /> <br />

&#lt;script language="vbScript" type="text/vbScript"&#gt;<br /> <br />

set xmlDoc=CreateObject("Microsoft.XMLDOM")<br /> 

xmlDoc.async="false"<br /> 

xmlDoc.load("xml/genXML.xml")<br /> 

document.write("&#lt;p class='bold'&#gt;")<br /> 

document.write("The original XML document:")<br /> 

document.write("&#lt;xmp&#gt;" & xmlDoc.xml & "</xmp&#gt;")<br /> 

document.write("&#lt;/p&#gt;")<br /> <br />

set newnode=xmldoc.createComment(" This is a comment node. ")<br /> 

xmldoc.documentElement.appendchild(newnode)<br /> <br />

document.write("&#lt;p class='bold'&#gt;")<br /> 

document.write("After appending the new node:")<br /> 

document.write("&#lt;xmp&#gt;" & xmlDoc.xml & "&#lt;/xmp&#gt;")<br /> 

document.write("&#lt;/p&#gt;")<br /> 

&#lt;/script&#gt;

-- Blah, blah, blah... --

If yes, how do i go about doing this.  i know that it can be done using XSLT, but is that my
 only recourse?

 

Thanks in advance.

One,

 



t a r i q   a m i n   a b d u r - r a h i m


--  i am what's next!



---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
Attachments:
unknown1

Thread:
tariq abdur-rahim
Joe English

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved