• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

Write into xml file

I'm trying to save structure in xml file

<script language="JavaScript">

function writeXML()
{

var oXML = new ActiveXObject("Microsoft.XMLDOM");
var oRoot = oXML.createNode("element", "customers", "");
oXML.appendChild(oRoot);
var oNode = oXML.createNode("element", "customer","");
oRoot.appendChild(oNode)
var oNode2 = oXML.createNode("element", "order","");
oNode.appendChild(oNode2)

oXML.save("prices.xml");

}
     </script>

In result i got error:
"Permission Denid"

Even I remove xml file, still I have this error, even i specify physical path.
0
dik_sychev
Asked:
dik_sychev
1 Solution
 
zvonkoCommented:
You have to set "Accessing Data Across Domains" to "enable"
Look here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmconxmlclientsecurity.asp

0
 
CJ_SCommented:
If it is done clientside you won't be able to. Change the file into an .hta file.

CJ
0
 
zvonkoCommented:
Hello,

try this:
<html>
<script language="JavaScript">
function writeXML()
{
var oXML = new ActiveXObject("Microsoft.XMLDOM");
var oRoot = oXML.createNode("element", "customers", "");
oXML.appendChild(oRoot);
var oNode = oXML.createNode("element", "customer","");
oRoot.appendChild(oNode)
var oNode2 = oXML.createNode("element", "order","");
oNode.appendChild(oNode2)
alert(oXML.xml)
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   var MyFile = fso.CreateTextFile("c:\\prices.xml", true);
   MyFile.Write(oXML.xml);
   MyFile.Close();
}
writeXML();
</script>
</html>

Good luck,
zvonko

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ahosangFinance Systems DeveloperCommented:
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or so. I appreciate any comments that would help me to make a recommendation.
 
In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care
 
ahosang
0
 
ahosangFinance Systems DeveloperCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ahosang
EE Cleanup Volunteer
0
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now