Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Oct 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Write to xml and save, js/local

    I trying to store a playlist in a xml file locally without using IIS.
    Im guessing it similar to writing to a text file, but not sure.
    A simple load rewrite and save technique is good enough,

    I'd also be open to useing C(+) it edit, and display the data.

    Thanks!

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Do you mean using JScript and Windows Scripting Host for doing it? You can do it through ActiveX objects. Have a look at <http://msdn.microsoft.com/scripting/>, it contains has the references you need.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #4
    New Coder
    Join Date
    Oct 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks guys, that was what I needed!

    Do you mean using JScript and Windows Scripting Host for doing it?
    Embedding JScript into a Windows Applications would be better for this, however Im a bit of a newbie at such things. Maybe after some reading

    The FileSystemObject is the same as writing to a text file (using javascript). (Heres a good link: http://www.webreference.com/js/column71/index.html) so for now atleast I'll be generic.

  • #5
    New Coder
    Join Date
    Oct 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Security warnings - permission denied

    Im guessing theres no "good" way to load and save a xml file using javascript.

  • #6
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've never been able to find any useful information for bypassing that "permission denied" error. I have only seen it with the xml save method, which is attempted in this article's example, but it doesn't work & there's no hint of how to use it properly.

    As far as activeX security-warnings go, the two ways I know of to eliminate them are either to use an .hta , or change the settings of your " local security zone " ... so if you are coding for the WSH, either of those options should work.

  • #7
    New Coder
    Join Date
    Oct 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks swmr you just opened up a whole new world I didn't know existed

    I didn't spend much time on the first link, and messing with the security setting isn't much of an option,

    But the HTA passed its initial test (load/save) with fling colors, it seems ideal.

    I'll put it to the test soon as I find a little time.

    Thanks again!!

  • #8
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just thought to add this test/demo here for anyone looking...
    Code:
    <html>
    <head>
    <title>xmlSave (HTA)</title>
    
    <?XML:NAMESPACE PREFIX = HTA />
    <HTA:APPLICATION />
    
    <script type="text/JScript">
    
    function persistXML(){
    
     with(dataIsland){
    
    if(xml && src){
    
    var xDOM = new ActiveXObject("Msxml2.DOMDocument.4.0");
    
    xDOM.loadXML(xml);
    
    xDOM.save(src);}
          }
    }
    </script>
    
    </head>
    <body>
    
    <XML id="dataIsland" src="myFile.xml" />
    
    <input datasrc="#dataIsland" datafld="dataNode">
    
    <button onclick="persistXML()">Save</button> 
    
    </body>
    </html>
    & the complex code to save as "myFile.xml"
    Code:
    <?xml version="1.0"?>
    <rootNode>
    	<dataNode>data...</dataNode>
    </rootNode>
    hmm... ?

  • #9
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    Three comments, not sure how relevant they are.

    (1) DOM 3 Load and Save is a W3C Recommendation, which I believe covers file access. The target for Mozilla's implementation is 1.8a.

    (2) The JSLib package from Mozdev does allow an application to access the filesystem for saving files, if the application is a Mozilla chrome app.

    (3) XMLHttpRequest can read files easily.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #10
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer No success with the XML element

    I confirm that the code that saves the ActiveX object works. However, if I try to do the same thing with an XML element embedded in the HTA, I get "Permission denied" again.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •