Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

XML DOM QUERY

Hi

I am facing some problem in XML. Please help me out if possible.

This is my XML file:


<?xml version="1.0"?>


Pop
Come On Over
Shania Twain


Country and Western
Red Dirt Girl
Emmylou Harris




And the following code is written in an HTML page:





set objXMLDoc=CreateObject("Microsoft.XMLDOM")
objXMLDoc.async="false"
objXMLDoc.load("albums.xml")
set NewText = objXMLDoc.createTextNode("Country")
document.write(objXMLDoc.documentElement.lastChild.firstChild.nodeName)
set Category = objXMLDoc.documentElement.lastChild.firstChild
set OldText = Category.firstChild
Category.replaceChild NewText, OldText
objXMLDoc.save("albums.xml")




In the above code, I am trying to replace an old node with a new one. When I run the HTML file in the browser I get an error message saying "Permission denied". I am not able to understand why is this so.

Please help me out.

Thanx
suvendu


Comments

  • lionblionb Posts: 1,685Member
    I'm not sure that will help by you can try it at least.
    According to Microsoft XML SDK 4.0 Help:
    Calling load or loadXML on an existing document immediately discards the content of the document.
    If loading an XML document from a resource, the load must be erformed asynchronously or the load will fail. For example:
    (Take a look at line with .async method)

    Set objXML = CreateObject("MSXML2.DOMDocument")

    ObjXML.async=true

    objXML.load "res://msxml.dll/DEFAULTSS.XSL"
    WScript.echo objXML.parseError.reason
    objXML.save "c:defaultss.xsl"




    : Hi
    :
    : I am facing some problem in XML. Please help me out if possible.
    :
    : This is my XML file:
    :
    :
    : <?xml version="1.0"?>
    :
    :
    : Pop
    : Come On Over
    : Shania Twain
    :
    :
    : Country and Western
    : Red Dirt Girl
    : Emmylou Harris
    :
    :
    :
    :
    : And the following code is written in an HTML page:
    :
    :
    :
    :
    :
    : set objXMLDoc=CreateObject("Microsoft.XMLDOM")
    : objXMLDoc.async="false"
    : objXMLDoc.load("albums.xml")
    : set NewText = objXMLDoc.createTextNode("Country")
    : document.write(objXMLDoc.documentElement.lastChild.firstChild.nodeName)
    : set Category = objXMLDoc.documentElement.lastChild.firstChild
    : set OldText = Category.firstChild
    : Category.replaceChild NewText, OldText
    : objXMLDoc.save("albums.xml")
    :
    :
    :
    :
    : In the above code, I am trying to replace an old node with a new one. When I run the HTML file in the browser I get an error message saying "Permission denied". I am not able to understand why is this so.
    :
    : Please help me out.
    :
    : Thanx
    : suvendu
    :
    :
    :

Sign In or Register to comment.