I have an ASP application that returns data requested by the user in various
formats.
Currently it returns the data as an Excel file that can be displayed or
saved.
I have added the feature of returning the same data in XML format, either as
a Data Island or as a file
download.
My intention is to allow the user to save the XML data either as a file or
load it into the local SQL
Server database (at the Client side.
It has been suggested to me by Microsoft MVPs in various newsgroups that the
Data island is the preferred method of delivery.
However I am running into a problem. Most of my customers run a VB6
application written by me with a Browser Control that allows the Scripting
FileSystemObject to extract the innerHTML of the XML data and save it to
file or Database.
I am trying to do the same thing with DHTML in an HTA page, for those
customers that don't subscribe to the VB6 application, but wish to use the
ASP site. The HTA application however is generating an error that I can't
seem to solve....
Error: Object required: 'objXML'
Note: The page is completely loaded into the browser, because the code is
called from an OnClick event from a button that is the last control loaded
in the page, well after the XML Data island is created.
Below is the source code from VB6 (that works) and the HTA code that
generates an error.
The line flagged is:
strHTML = objXML.innerHTML
Can anyone tell me what the problem might be?
If the Data Island is the preferred method of delivery, how do I go about
committing it to disk or SQL
Server (at the Client site) without using VB6 code?
If I can't find an answer soon, I will resort to file download and then deal
with file-handling issues
that might make it difficult for the user and myself, such as making sure
the file is placed in a specific location that can be accessed easily for
loading into SQL Server.
--- VB6 Code that works properly on the XML data island ---
Private Sub GetXMLData() As Boolean
Dim objDoc As Object
Dim objXML As Object
Dim strHTML As String
Dim ts As Object, fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.CreateTextFile("PCardTest.xml", True)
Set objDoc = Me.PCardBrowser.document
Set objXML = objDoc.All("pcXML")
strHTML = objXML.innerHTML
ts.Write strHTML
ts.Close
End Sub
-- Script Code in HTA page that generates error --
<SCRIPT language=vbscript>
sub saveTOfile()
Dim objDoc
Dim objXML
Dim strHTML
Dim ts
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.CreateTextFile("c:\temp\PCardTest.xml", True)
Set objXML = document.all("pcXML")
strHTML = objXML.innerHTML
ts.Write strHTML
ts.Close
end sub
</SCRIPT>
Thanks for your help......