Jump to content

Loading XML file using vbscript


dooberry

Recommended Posts

:) I've sorted loading up a file and editing the data using a form, the problem I seem to have now is that Explorer won't let me save the file after I've changed the information.I've written the following script in the xsl file that I've loaded dynamically:
Sub submitrecord	Dim xmldoc, rootel, nodeel-- this loads the document into a variable --	set xmldoc=CreateObject("Microsoft.XMLDOM")	xmldoc.load("QuoteContact.xml")	xmldoc.async="false"-- this parses through the document nodes that I need to edit and gets their new values from controls on the current page --	set rootel=xmldoc.documentelement	set nodeel=rootel.selectSingleNode("FAO/Contact")	nodeel.text=Document.getelementbyid("faocontact")	set nodeel=rootel.selectSingleNode("FAO/FAOCompanyname")	nodeel.text=Document.getelementbyid("faocompany")	set nodeel=rootel.selectSingleNode("FAO/FAOAddress1")	nodeel.text=document.getelementbyid("faocompanyaddress1")-- this is where the problem starts - I get the message "Access is denied". I'm using a local file path to store the xml, but it's as if the file is locked when I load it --                  xmldoc.save "c:\mynewquotecontact.xml"-- this is where I free up the memory pointers --	set xmldoc =nothing	set root = nothing	set node = nothing  End Sub

Can anyone tell me if I can open the xml document using the load method without creating a lock on the file?Any help would be greatly appreciated.Dooberry

Link to comment
Share on other sites

:) Ok, this is a real pig!The problem is not with the file. I've created the document from scratch and appended an element to the document by reading the html form.When explorer gets to the line to save the document as a new file, it still says 'xmldoc.save: Access Denied'.Has anyone else encountered this?Is this an issue with VBScript that doesn't apply with JavaScript?Is this a browser setting that I can change?I'll let you know if I get the same problem with JavaScript as I am getting with VBScript.It's all fun and games till someone loses their data. :)Dooberry
Link to comment
Share on other sites

I've been handed some research on this topic and it's something I'd never even heard of (being quite new to all this web development malarkey). Apparently, htm files do not have access to a client but hta files do. I changed the suffix of the file and it all works beautifully.It would be useful to cover stuff like this in the tutorials, something about explaining what different file types do in html applications?If this is already covered, can someone tell me where please?Dooberry.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...