...

View Full Version : xml/asp



flyclassic
09-24-2002, 07:16 AM
'Creating a NodeList of the elements in the XML Tree
Set objNodeList = objDom.documentElement.childNodes


'Loop through each item in the NodeList and check if its NodeType is that of a Processing Instruction i.e.

for i = 0 to objNodeList.length

Set objNode=objNodeList.item(i)
If objNode.nodeType = 7 then

set objNewPI = objDom.createProcessingInstruction("YourApp"," ")
objNewPI.data = objNode.data

objNode.parentNode.replaceChild objNewPI, objNode

End If

next


These is the script to modify the xml processing instructions. Its actually written in javascript but i've converted it to ASP and it can't work.

In the asp file, whenever it runs till

Set objNode=objNodeList.item(i) line, it has error occured. and thus i can't save my file.
anybody can help....?



original xml /javascript is
<SCRIPT >

/*Declaring memvars to be used later */
var objDOM;
var objNode;
var objNodeList;
var objNodeListEle;
var i;
var objNewPI;

/* Instantiating the XML Parser */
objDOM = new ActiveXObject("MSXML.DOMDocument");

/*Opening the file nodename.xml inysc mode */
objDOM.async = false;
objDOM.load("ModProcInstr.xml")

alert("ModProcInstr.xml loaded in memory")

/*Creatubg a NodeList of the elements in the XML Tree */
objNodeList = objDOM.documentElement.childNodes;

/*Establishing and Displaying the number of elements in the XML tree in memory */
objNodeListEle = objNodeList.length

alert("The number of elements in the NodeList array is:" + objNodeListEle);

/*Loop through each item in the NodeList and check if its NodeType is that of a Processing Instruction i.e. 7*/
for(i=0;i<objNodeList.length;i++)
{
objNode=objNodeList.item(i);

if(objNode.nodeType ==7)
{
objNewPI = objDOM.createProcessingInstruction("YourApp"," ");
objNewPI.data = objNode.data
objNode.parentNode.replaceChild(objNewPI, objNode);
alert("New Processing Instruction created");
}
}

Alex Vincent
09-25-2002, 02:58 AM
Cross-posted and CLOSED:
http://www.codingforums.com/showthread.php?s=&postid=30934#post30934

Please do not post the same question to two or more forums. It confuses people trying to help you and annoys moderators (like me).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum