www.webdeveloper.com
Results 1 to 3 of 3

Thread: read XML file

  1. #1
    Join Date
    Feb 2006
    Location
    Ft Lauderdale
    Posts
    299

    read XML file

    I have a external file that hold my XML

    but i am having problems reading this file.

    does any one have any good code that can read this.

    my file name is always going to be myXML.xml and is the the same directory as my web site

  2. #2
    Join Date
    Feb 2006
    Location
    Ft Lauderdale
    Posts
    299
    what i have now is a asp function reading the file and passing it to JS in a response. write()

    but it's not really working properly


    Code:
       <% call readFile() %>
    
    
    <% 
    sub readFile() 
    
    
    	dim fs,f,ts
    		set fs=Server.CreateObject("Scripting.FileSystemObject")
    		Set f=fs.GetFile("path\myXML.xml")
    		Set ts=f.OpenAsTextStream(1)
    
    
    		
    			Response.Write("<script language='javascript'>")
    			'Response.Write("	ReturnXml2('String literal')	")
    			'Response.Write("	setTimeout(ReturnXml2('ts.ReadAll'), 5000);	") ' This works 
    			Response.Write("	setTimeout(ReturnXml2('"&ts.ReadAll&"'), 1000);	")
    			Response.Write("</script>")				
    			'Response.Write(ts.ReadAll)
    
    	ts.Close
    	set ts=nothing
    	set f=nothing
    	set fs=nothing
    
    
    end Sub 
    
    %>
    
    
    
    Code:
    <script language="javascript">
    	function saveXml (myText) {
    	var url2 = 'saveFile.asp';
    	var xmldoc="xmldoc="+encodeURI(myText);
      if (window.XMLHttpRequest) { // Mozilla
       objHTTP=new XMLHttpRequest();
      } else if (window.ActiveXObject) { //IE
       objHTTP=new ActiveXObject('Microsoft.XMLHTTP');
      }

  3. #3
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    You do not have to crate a new thread when you already have one on the same topic

    http://webdevelopers.com/forum/showt...d=1#post764251

    I added an answer there...

    Eric

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles