Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 22nd, 2006, 08:51 AM
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create a new XML file with vbscript

Could someone point me to a tutorial or example that will show me how to create an XML file with vbscript

I just want to save the XML file to the C:\ drive, and I cannot use ASP or any server side scripts.

I just want a brand new XML file in that folder that looks something like

<root>
<info>test</info>
<info2>my info goes here</info2>
</root>

I cant find any online tutorial that will show me how to do this.

Thanks!

 
Old April 23rd, 2006, 10:42 PM
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got something put together that I think should work, but its not. It runs with no errors, but I dont get a file created. Here is my code:
<html>
<body>
<script languate="vbscript">




Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.createTextfile("C:\temp\NewXmlFile.xml", True)
    With f
        .Writeline "<root>"
    .Writeline "<element>test</element>"
    .Writeline "</root>"
        .Close
    End With

    Set xmlDom = CreateObject("Microsoft.XMLDOM")
    XmlDom.async = False
    XmlDom.Load("C:\temp\NewXmlFile.xml")

    XmlDom.Save("C:\temp\NewXmlFile.xml")


</script>
</body>
</html>

 
Old April 24th, 2006, 03:28 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You're asking questions about browser security settings, Javascript etc, which have nothing to do with XML and are off-topic for this forum. You might hit lucky and get an answer from someone, but not from me.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 24th, 2006, 07:01 AM
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hoes does creating an xml file with VBSCRIPT have ANYTHING to do with browser security settings, or javascript? Sorry that I'm such a newb, but it seems that it fits to me. I want to create an xml file, so Im in the xml forum...

 
Old April 24th, 2006, 07:31 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your problem is creating a file from within the browser. The fact that it's an XML file is irrelevant. Normal browser security settings prevent you from modifying the filestore on the client machine.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create XML file from SLQ Server2000 using vbScript ilearn XML 1 September 5th, 2008 02:32 AM
Create XML file - add elements according to range remya1000 XML 5 October 3rd, 2007 02:50 PM
Create XML file - According to the Value, add elem remya1000 General .NET 0 October 2nd, 2007 11:03 PM
Problem to create an xml file from two xml files saurabh_inblore XSLT 1 April 12th, 2006 02:58 AM
create xml file using c# kk_katepally General .NET 2 February 11th, 2005 02:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.