Re: Error extracting innerHTML using DHTML in an HTA page
From: John Kotuby (jkotuby_at_snet.net)
Date: 08/17/04
- Next message: Jack: "Event Log Dump Parsing"
- Previous message: Gerry: "Re: enumerating the system environment"
- In reply to: John Kotuby: "Error extracting innerHTML using DHTML in an HTA page"
- Next in thread: Bob Barrows [MVP]: "Re: Error extracting innerHTML using DHTML in an HTA page"
- Reply: Bob Barrows [MVP]: "Re: Error extracting innerHTML using DHTML in an HTA page"
- Reply: Michael Harris \(MVP\): "Re: Error extracting innerHTML using DHTML in an HTA page"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 17 Aug 2004 11:51:35 -0400
My apologies to the group. I discovered my mistake. Too many technologies to
learn and very little time to read all the books.
I originally started with an ASP page that returned the XML data island. I
then tried using the FileSystemObject within DHTML of the ASP page and found
that I wasn't allowed (apparently) to create that object from within an ASP
page.
Then I discovered the HTA information in MSDN, that indicates how the FSO is
allowed in an HTA and that an HTA can be created by simply changing the file
extension. Therein lies the mistake. I ASSUMED that the same XML would be
returned in the HTA as it was in the ASP page. WRONG!
By using the HTA extension, the ASP engine on the server did not process my
server-side code to return the XML, but rather returned all the code intact.
What a dumb rookie mistake.
So I guess the question then becomes, how do I go about extracting that XML
data from an ASP page in the Client browser without wrapping it in a VB
application that allows the use of the FSO. Is that even possible?
Thanks .....
"John Kotuby" <jkotuby@snet.net> wrote in message
news:OwrqTlGhEHA.3944@tk2msftngp13.phx.gbl...
> 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......
>
>
- Next message: Jack: "Event Log Dump Parsing"
- Previous message: Gerry: "Re: enumerating the system environment"
- In reply to: John Kotuby: "Error extracting innerHTML using DHTML in an HTA page"
- Next in thread: Bob Barrows [MVP]: "Re: Error extracting innerHTML using DHTML in an HTA page"
- Reply: Bob Barrows [MVP]: "Re: Error extracting innerHTML using DHTML in an HTA page"
- Reply: Michael Harris \(MVP\): "Re: Error extracting innerHTML using DHTML in an HTA page"
- Messages sorted by: [ date ] [ thread ]