asp / sql code in xml file possible? or other options to retrieve recordset in xml

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #16
    im not sure what you mean by 'dump the result into a file'...
    I mean: "save as …"

    so it appears that you have to save the result XML code to a file, since the 3rd party does not/cannot make use of the ASP interpreter. (you have to write a script, that generates the XML file)

    Comment

    • JamieHowarth0
      Recognized Expert Contributor
      • May 2007
      • 537

      #17
      OK, so you need to generate an XML file from database data, which is then accessed via FTP via a third-party.

      You'd generate the XML file as a string in ASP, then save it as an XML file to disk.
      In pseudo-code:
      Code:
      <%
      'Connect to DB
      String myXml = "<price>{0}</price>"
      'dr is your recordset with the data pulled from your DB
      String myXml = Replace(myXml, "{0}", dr("Price"))
      Dim fso = CreateObject("Scripting.FileSystemObject")
      Set fs = fso.CreateTextFile("myXmlFile.xml") 
      fs.WriteLine(myXml) 
      fs.Close
      Set fs = Nothing
      %>
      Hope this helps.

      codegecko

      Comment

      • Monomachus
        Recognized Expert New Member
        • Apr 2008
        • 127

        #18
        Originally posted by omar999
        we do not send them the file via email thats for sure - they appear to read it as they have ftp access to our files etc but I will find out for 100% sure on details.

        im not sure what you mean by 'dump the result into a file'...
        Excuse me, but this is not a great idea. Why don't you try to work with XML from ASP and not inverse? I mean usually you'd have some data you need to insert into XML but this isn't too complex. I mean putting an ASP into XML just to take one value from database... is too strange and isn't really professional. I mean look at alternatives really. Perhaps the most correct thing to have a method that will do that for you and you just insert this value into xml.

        Comment

        • omar999
          New Member
          • Mar 2010
          • 120

          #19
          codegecko - thanks for your reply. I've read your post several times and although I may not fully understand but I think this may be the way forward to generate the xml and then save the file on our server.

          Monomachus - im trying to eradicate the need to manually enter in any data in to the xml file while it can just retrieve this data directly from our db. hence i want to automate this process. i need to retrieve aprox 4 values from sql db in to this xml file - and there's about 8 xml files so in the long run it will be worthwhile.

          Comment

          Working...