[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to save the xml file after I've been using DOM?

Posted on 2003-11-10
2
Medium Priority
?
364 Views
Last Modified: 2012-05-04
Hi!

I've read the DOM tutorial at w3-schools, and I wonder how I can save the xml file which I've have appended elements to.

My html file is:

<html>
<body>

      <script type="text/vbscript">

      set xmlDoc=CreateObject("Microsoft.XMLDOM")
      xmlDoc.async="false"
      xmlDoc.load("cust.xml")

      document.write("The original XML:")
      document.write("<xmp>" & xmlDoc.xml & "</xmp>")

      set newnode=xmldoc.createElement("cancel")
      xmldoc.documentElement.appendchild(newnode)

      document.write("After appending the new node:")
      document.write("<xmp>" & xmlDoc.xml & "</xmp>")
      xmlDoc.save("cust.xml")
      </script>


      
</BODY>
</HTML>

When I start it I get the error:
Error: Permission denied: 'xmlDoc.save'

I have shared the directory in which these two files are (cust.xml and my html page)

Can anyone help me out?

Thanks in advance!

Best regards,
Tom-Erik
0
Comment
Question by:tomerikv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
rdcpro earned 280 total points
ID: 9723819
You can't do this from an HTML page loaded from a web server.  Security restrictions.  If the HTML page is local (as it sounds like it is) you can rename the page to *.hta.  This will override the security restrictions in HTML pages.  HTA (HTML Applications) run in an elevated security context, but you'll notice the browser toolbar and menus are gone.  You have to implement these yourself in the page.  If you eventually have to serve this from a web server, you'll run into problems.

I think you can do this in an HTML page if it's loaded from the local filesystem, but you have to mess with the security of the local folder...I can't recall for sure how, or if it's even possible.  I always use HTA's when trying stuff like this.

By the way, use MSXML 3, not 2.  Change:

    set xmlDoc=CreateObject("Microsoft.XMLDOM")
to:
    set xmlDoc=CreateObject("Msxml2.DomDocument")

especially in this case, where you know what the environment is.


Regards,
Mike Sharp



0
 
LVL 1

Author Comment

by:tomerikv
ID: 9725139
Hi!

Thanks a lot!

It worked!

Best regards,
Tom-Erik
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question