XML Import-Export Forum :: xml to file automatically

This thread was displayed: 970 times


Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.

For more information about the affected products visit: www.interaktonline.com/Support/

View Threaded Show all Show descending
aaron westberg
11-04-2005 21:46:40 GMT +2

 

is it possible to have the extension automatically save the .xml file without the user being prompted to save it?  How is this done?  I would like to use this extension at the beginning of  an .asp page to first generate the .xml file (automatically/transparently) and later in the page to load this newely created file into a flash movie.  Can this be done?
thanks
Back | Reply | Quote | Top
Razvan Racasanu[InterAKT]Adobe Systems Romania staff
11-08-2005 11:28:54 GMT +2

Hello,

You cannot configure XML Import Export to save the content to a file, because it sends download headers to the browser. However, this extension can be modified to save the content to a file but this requires custom coding. If you are interested in this, please read the following page: http://www.interaktonline.com/Support/Commercial-support/

Regards,
Razvan RACASANU

Reply | Quote | Top
alain962
12-19-2005 05:15:16 GMT +2

In your asp page that call the export Table ti XML just add these (red) lines. The Name of the Table is below "MyTABLE"

' Begin XMLTableExport
Dim xml_tableexport1: Set xml_tableexport1 = new XML_TableExport
xml_tableexport1.init MyCONN
xml_tableexport1.setTable "MyTABLE"
xml_tableexport1.setMaxRecords "ALL"
xml_tableexport1.setXMLEncoding "UTF-8"
xml_tableexport1.setXMLFormat "NODES" 
   Response.ContentType = "text/xml"
   Response.AddHeader "content-disposition", "attachment; filename=" & "MyTABLE.xml"
      Response.Write(mXMLOutput)
xml_tableexport1.Execute "VALUE", "1"

Reply | Quote | Top
aaron westberg
12-19-2005 17:03:42 GMT +2

thanks Alain, so if i understand correctly, by adding those 3 lines of code in read the xml file will be created on the fly without any user interaction? then later i can load the xml file into a flash movie that resides further down the page code? And all of this would be transparent from the user?

Reply | Quote | Top
alain962
12-19-2005 19:24:19 GMT +2

Sorry. Thes three lines allow the user to download directly the XML file (this one is "pushed").

If I understand what you want, I guess you have to use the FSO Object to save the XML file on the server.

Reply | Quote | Top
alain962
12-19-2005 19:53:19 GMT +2

If you want to save the recordset (or Table) as a XML File you have to replace in the /includes/xml/XML_TableExport.class.asp the Function Execute .... End Function by this function

 '******************************************

Function Execute(method, reference, myPATH, myXMLFILE)
  ret = KT_getRealValue(method, reference)
  If NOT KT_isSet(ret) Then
   Exit Function
  End If
  
  If sortByField <> "" Then
   sqlString = "SELECT * FROM " & table & " ORDER BY " & sortByField & " " & order
  Else
   sqlString = "SELECT * FROM " & table
  End If   


  On Error Resume Next
  Dim recordset
  Set Recordset = Server.CreateObject("ADODB.Recordset")
  Recordset.ActiveConnection = connectionString
  If err.Number <> 0 Then
   Response.write "<strong>XML_Export Error.</strong><br/>Couldn't open the database using the supplied connection string."
   On Error GoTo 0
   Exit Function
  End If
  Err.Clear

  Recordset.Source = sqlString
  Recordset.CursorType = 0
  Recordset.CursorLocation = 2
  Recordset.LockType = 1
  Recordset.Open()
  
  If err.Number <> 0 Then
   Response.write "<strong>XML_Export Error.</strong><br/>Could'n create recordset: '" &  sqlString & "'<br/>Error Message: " & err.Description
   On Error GoTo 0
   Exit Function
  End If
  On Error GoTo 0
  
  
  For each field in Recordset.Fields
   columns.Add field.name, ""
  Next
  
  
  numRow = 1
  Set row = new XML_TableExport_StringBuilder
  row.Concat "<" & "?xml version=""1.0"" encoding=""" & xmlEncoding & """?" & ">" & vbNewLine
  row.Concat "<"  & table  & ">" & vbNewLine
  
  Do While Not Recordset.EOF
   If maxRecords <> "ALL" Then
    If Cint(maxRecords) < numRow Then
     Exit Do
    End If 
   End If
   row.Concat vbTab
   row.Concat "<row"
   If xmlFormat <> "ATTRIBUTES" Then
    row.Concat ">" & vbNewLine
   End If
   For each column in columns
    value = recordset.Fields.Item(column).Value
    value = escapeValue(value)
    ' decode value ??

    If xmlFormat = "ATTRIBUTES" Then
     row.Concat " " & column & "=""" & value & """"
    Else 
     row.Concat vbTab & vbTab & "<" & column & ">" & value & "</" & column & ">" & vbNewLine
    End If
   Next
   
   If xmlFormat = "ATTRIBUTES" Then
    row.Concat " />"
   Else
    row.Concat vbTab & "</row>" 
   End If
   row.Concat vbNewLine
   numRow = numRow + 1
   Recordset.Movenext
  Loop
  row.Concat "</"  & table  & "

View full message
Reply | Quote | Top
aaron westberg
12-19-2005 21:13:11 GMT +2

awesome! then it will automatically generate the xml file and save it to the server without any user interaction? Just want to make sure. This would be a very nice feature to have on an up coming release. Thanks Aaron

Reply | Quote | Top
Ionut MOICIANU
12-21-2005 18:15:40 GMT +2

Hello,

Let us know if the solution works for you, Aaron. We will note this down as a feature request.

Thanks for the support, Alain.

Ionut 

Reply | Quote | Top
Zulians
07-16-2007 15:25:11 GMT +2

Alain,

Can you please tell me how I can do it with php? to save xml as a file instead of downloading.?


Thank you so much

Zulian

Reply | Quote | Top
Zulians
07-20-2007 14:31:27 GMT +2

Can any user help me to explain how I can save exported XML recordset to a file in the server instead of trying to open it in the browser. it like alain962 has explained here http://www.interaktonline.com/Products/Dreamweaver-Extensions/XMLImport-Export/Product-Forum/Details/62426/xml%20to%20file%20automatically.html  to do it ASP export table.

I am trying to save it with import export xml from a recordset to a php server.

Thank you.

Zulian

Reply | Quote | Top
Zulians
07-24-2007 23:50:15 GMT +2

Hello Alain,

I am crying for the whole nation of interAKT to help me and teach me how can I save the xml file in the server automatically by using import export xml extension by using recordset.

Please please please somebody help me to do this. I know the forum is now user to user forum, but users please help me to do this with your guys kind help. 

I NEED YOUR HELP.

Thank you


Reply | Quote | Top
© Adobe Systems Romania. All rights reserved.