eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTML::Visitor':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Visitor (in HTML)


Inheritance:

   Object
   |
   +--HTML::Visitor
      |
      +--HTML::Encoder
      |
      +--HTML::TextExtractor

Package:
stx:goodies/webServer/htmlTree
Category:
Net-Documents-HTML-TreeBuilder
Version:
rev: 1.41 date: 2019/07/13 12:20:40
user: cg
file: HTML__Visitor.st directory: goodies/webServer/htmlTree
module: stx stc-classLibrary: htmlTree

Description:


this is an abstract framework class which does the dispatch based on the HTML tag.
The minimum to redefine are visitString: and visitElement:,
although you can redefine any of the visitXXX: methods to directly get dispatched into it.


Instance protocol:

interface-visiting-BlockLevel
o  visitAddress: anAddress
An address gets visited.

o  visitArea: anArea

o  visitBlockQuote: aBlockQuote
A blockQuote gets visited.

o  visitCenter: aParagraph
A 'center' gets visited.

o  visitDiv: aDiv
A div gets visited.

o  visitEmbed: anEmbeddedDocument

o  visitHeading1: aHeading1
A heading level one gets visited.
Rubbish: this is never called; instead visitHeading: is called for all levels

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  visitHeading2: aHeading2
A heading level two gets visited.
Rubbish: this is never called; instead visitHeading: is called for all levels

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  visitHeading3: aHeading3
A heading level three gets visited.
Rubbish: this is never called; instead visitHeading: is called for all levels

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  visitHeading4: aHeading4
A heading level four gets visited.
Rubbish: this is never called; instead visitHeading: is called for all levels

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  visitHeading5: aHeading5
A heading level five gets visited.
Rubbish: this is never called; instead visitHeading: is called for all levels

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  visitHeading6: aHeading6
A heading level six gets visited.
Rubbish: this is never called; instead visitHeading: is called for all levels

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  visitHeading: aHeading
A heading gets visited.

o  visitHorizontalRule: aHorizontalRule
A horizontal rule gets visited.

o  visitParagraph: aParagraph
A paragraph gets visited.

o  visitPre: aPre
A pre gets visited.

interface-visiting-FontStyle
o  visitBig: aBig
A 'big' gets visited.

o  visitBold: aBold
A 'bold' gets visited.

o  visitItalic: anItalic
An italic gets visited.

o  visitSmall: aSmall
A 'small' gets visited.

o  visitStrong: anElement

o  visitStyleElement: anElement

o  visitUnderlined: aSmall
An underlined gets visited.

interface-visiting-Form
o  visitButton: aButton
A button gets visited.

o  visitForm: aForm
A form gets visited.

o  visitFormElement: anElement

o  visitInput: anInput
An input gets visited.

o  visitLabel: anInput
A label gets visited.

o  visitOption: anOption
An option gets visited.

o  visitSelect: anSelect
A select gets visited.

o  visitTextArea: anInput
A textarea gets visited.

interface-visiting-Frame
o  visitFrame: aFrame
A frame gets visited.

o  visitFrameset: aFrameset
A frameset gets visited.

o  visitIFrame: anIFrame

o  visitNoFrames: aNoFramesElement
A noframes element gets visited.

o  visitNoScript: aNoScriptElement

interface-visiting-Head
o  visitBase: aBase

o  visitLink: aLink
A link gets visited.

o  visitMeta: aMeta
A meta element gets visited.

o  visitScript: aScript
A script gets visited.

o  visitStyle: aStyle
A style element gets visited.

o  visitTitle: aTitle
A title gets visited.

interface-visiting-Inline
o  visitAnchor: anAnchor
An anchor gets visited.

o  visitBreak: aLineBreak
A line break gets visited.

o  visitCode: anImage
A code gets visited.

o  visitImage: anImage
An image gets visited.

o  visitNoBr: anImage
A noBr gets visited.

o  visitSpan: anImage
A span gets visited.

interface-visiting-List
o  visitComment: anItem
A comment gets visited.

o  visitListItem: aListItem
A list item gets visited.

o  visitOrderedList: anOrderedList
An ordered list gets visited.

o  visitProcessingInstruction: anItem
A processing instruction gets visited.

o  visitUnorderedList: anUnorderedList
An unordered list gets visited.

interface-visiting-ListDefinition
o  visitDefinitionDescription: aDefinitionDescription
A definition description gets visited.

o  visitDefinitionList: aList
A definition list gets visited.

o  visitDefinitionTerm: aTerm
A definition term gets visited.

interface-visiting-Special
o  visitDocumentType: aDocumentType
A document type gets visited.
The document type is no real html element.
It only holds the version string.
Do nothing here.

interface-visiting-Table
o  visitCaption: aCaption
A table caption gets visited.

o  visitCol: aCol
A col gets visited.

o  visitColgroup: aColgroup
A colgroup gets visited.

o  visitTable: aTable
A table gets visited.

o  visitTableBody: aTableBody
A table body gets visited.

o  visitTableDataCell: aTableDataCell
A table data cell gets visited.

o  visitTableFoot: aTableFoot
A table foot gets visited.

o  visitTableHead: aTableHead
A table head gets visited.

o  visitTableHeaderCell: aTableHeaderCell
A table header cell gets visited.

o  visitTableRow: aTableRow
A table row gets visited.

interface-visiting-TopLevel
o  visitBody: aBody
A body gets visited.

o  visitDocument: aDocument
A document gets visited.

o  visitDummyContainer: aContainer
The container has no tag; however, its children are treated as usual

o  visitHead: aHead
A head gets visited.

required-visiting
o  visitElement: anElement
Default method for all html elements.
To be defined in subclasses.

** This method raises an error - it must be redefined in concrete classes **

o  visitString: aString
Default method for all html text pieces.
To be defined in subclasses.

** This method raises an error - it must be redefined in concrete classes **

visiting
o  visit: anObject
Visit an object.

o  visitSubelement: aSubElement
Visit a subelement.
Hook for redefinition.
Some subclasses may want to have a hook
here to do something special before or
after visitng a subelement.
See Encoder for example.

o  visitSubelementsOf: anElement
Visit the subelements of an element.


Examples:


ElementTypes := nil. HTMLParser initializeElementTypes
  |p in document visitorClass visitor|

  p := HTML::HTMLParser new. 
  in := '../../../exept/expecco/projects/not_delivered/buggyWebShopDemo/selenium_tests/buggyWebshop_bestellung'
               asFilename readStream.
  document := p parseText:in.
  in close.

  Smalltalk withoutUpdatingChangesDo:[
      visitorClass := HTML::Visitor 
                              subclass:#TestVisitor
                              instanceVariableNames:''
                              classVariableNames:''
                              poolDictionaries:''
                              category:''.

      visitorClass compile:'visitElement:anElement self visitSubelementsOf:anElement'.
      visitorClass compile:'visitString:aString'.
      visitorClass compile:'visitTableRow:aTR 
  aTR children size > 1 ifTrue:[
      |cmdTD argTDs cmd args|

      cmdTD := aTR children first.
      argTDs := aTR children copyFrom:2.

      cmd := cmdTD children first.
      args := argTDs collect:[:td | td children firstIfEmpty:nil].
      args := args copyTo:(args findLast:[:arg | arg notNil]).
      Transcript show:cmd; show:'' ''; showCR:args.
  ]
'.
  ].
  visitor := visitorClass new.
  visitor visit:document.


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 18 Aug 2022 13:15:52 GMT