HTML Support Framework
Description

This framework has been designed to read and generate HTML files in Smalltalk and autocode classes of  HTMLObject from an HTML language specification file.  This last feature allows the framework to be updated to new versions of HTML simply by reading a new language specification.  A specification for HTML 3.0+  is included.  The framework is also suitable for dynamic generation of  HTML pages upon a Web server.  Web pages may be read by the  framework and then its information converted to objects in Smalltalk.  The success of this conversion is limited by the correctness of the HTML source.

Files

This distribution includes the following files:
 
HtmSt.Prj
HtmSt.st
Source of basic framework classes independent of HTML version.
htmlSpec.txt Specification file for the HTML to Smalltalk code generator.   The file with this distribution specifies HTML 3.0+. 
HtTools.St 
HtTools.Prj 
Source for the HTML to Smalltalk code generator.  Requires htmlSpec.txt to build the code for a particular HTML version.
HtSamp.St 
HtSamp.Prj
Source for samples demonstrating use of this kit.
HTML Workbench.txt Demo workspace expressions with description.

Additional files are included with the distribution in order to simplify creation of a working directory with VSE 3.1.2 to test the library.

Requirements

VS/VSE 3.1.2 for Win32s.  Requires the following libraries:
 
ARAddIns.sll SelfDefinedStructures support
ARMisc.sll Misc. OS Support
ARPatchs.sll Patches and bug fixes
vslb31.sll Smalltalk Library Builder

Installation

Unzip the archive to a new directory.   For Windows 95 or NT 4.0, create a shortcut to working version of this image by dragging and dropping VDEVW.EXE from the installation directory to the desktop.  Right click on the shortcut to edit its properties.   Change the target field to include 'v.exe' as a parameter, i.e.

 Target: <install-dr>\vdevw.exe v.exe
 Start in: <install-dr>

Edit the vdevw.bnd file that was installed or add the following lines to the bottom of your vdevw.bnd file.

"========================="
; Object Store Writer
VOSW31.SLL
; Registration Database Support
VREG31W.SLL

; Smalltalk Library Builder
VSLB31.SLL

; Alejandro Reimondo libraries
ARBase.Sll
ARAddIns.Sll
ARMisc.Sll
ARDev.Sll
ARPatchs.Sll
"========================="

When the image starts it will bind required libraries and source.  Answer 'Yes' if it requests to file in generated source code. If you wish to create SLLs from the source answer 'Yes' when prompted (HtmSt2.sll). All the *.st files in the installation directory will be filed in. When this completes open a workspace on Html Workbench.txt.

You may build libraries from the source for later use.  The libraries built will have the same root name as the *.st files.

Alternately, if you wish to install the library to an image of  your choice ensure the SLL and DLL libraries above are copyed to the VS/VSE library directory or a directory that appears in the Windows PATH statement.   Include the Ht*.sll files created from a previous session in the .bnd file definition.  Remove or edit the Current.project file so that the file-in source is not filed in at the time the image starts.

Examples

The file Html Workbench.txt contains a number of demo expressions that show how the framework may be used.  Before trying the examples modify the method HTMLSample>>htmlBrowser to answer the path name to your Netscape or IE4 browser (e.g. ^'D:\Netscape\Communicator\Program\NETSCAPE.EXE').  Also file in the coding below to fix a few bugs with loading a web page after a defined time delay or opening the browser on an example.

!HTMLHeader methodsFor: 'as yet unclassified' !

load: anURL in: aTime
    " Signal the receiver to load page at anURL when aTime has been elapsed. "

    | seconds meta validURL |
    seconds := aTime isTime ifTrue: [ aTime asSeconds ] ifFalse: [ aTime ].
    meta := self class meta.
    meta
        httpEquiv: 'Refresh';
        content: seconds asString,'; url=',anURL asString;
        yourself.
    self add: meta! !

!HTMLSample methodsFor: 'as yet unclassified' !

browse
    "Save the page and browseIt."

    | arguments |
    self save.
    arguments := (URL file: (File fullPathName: self pathName)) asString.

    [ File execute: self htmlBrowser,' ',arguments ]
    on: FileError do: [
        self page asString edit.
        self error: 'Can''t open HTML Browser. Verify method ',self class name,'>>#htmlBrowser'
    ].! !

FileOutAllSite removeSelector:#browse!

Try evaluating the following example in the workspace file.  This uses the framework to generate HTML file descriptions of HTMLObject and HTMLSample and their subclasses.

    FileOutAllSite run.

The following example in the workspace file also requires the file arpegio.wav be installed/available on Windows.

  ArpegioSample run.

Additional info

Many of the methods in the AR SLL libraries appear not to be needed for this application.  Removal of these methods may allow this library to operate on OS/2.

The reading of Web pages for generation of Smalltalk objects is not so robust and if the Web page is poorly created errors or omissions in the generated models can occur.  A great number of pages on the Internet may be badly formed and the parser can become confused with these.  Different browser versions handle these page errors differently.

For reference, a description of the HTML 4.0 or 3.2 standard may be found at http://www.w3.org/MarkUp/.  A web page validator is available at http://validator.w3.org/.

Contact

Alejandro F. Reimondo
Amenabar 3476 Piso: 2 Dto: B.
Ciudad de Buenos Aires.
Argentina.
Tel: (54)-1-703-5586.
aleReimondo@sugarWeb.com
http://www.sugarweb.com


Links to:
The ObjectShare web site
VisualSmalltalk Product Support
ObjectShare's Online Documentation Site