Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: xml/asp

  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    xml/asp

    '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");
    }
    }

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,461
    Thanks
    1
    Thanked 23 Times in 21 Posts

    Thumbs down

    Cross-posted and CLOSED:
    http://www.codingforums.com/showthre...0934#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).
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •