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.45 date: 2022/10/07 13:53:05
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.

copyright

COPYRIGHT (c) 2003 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Instance protocol:

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

o  visitArea: anArea

o  visitBlockQuote: aBlockQuote
A blockQuote gets visited.

o  visitCenter: anElement
A 'center' gets visited.

o  visitDel: aDel
A del 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  visitAbbr: anElement
An 'abbr' gets visited.

o  visitArticle: anElement
An 'article' gets visited.

o  visitAside: anElement
An 'aside' gets visited.

o  visitAudio: anElement
An 'audio' gets visited.

o  visitBdi: anElement
A 'bdi' gets visited.

o  visitBdo: anElement
A 'bdo' gets visited.

o  visitBig: aBig
A 'big' gets visited.

o  visitBold: aBold
A 'bold' gets visited.

o  visitEm: el
A 'em' gets visited.

o  visitItalic: anItalic
An italic gets visited.

o  visitMark: element
A 'mark' gets visited.

o  visitSamp: aSamp
A 'samp' gets visited.

o  visitSmall: aSmall
A 'small' gets visited.

o  visitSource: anElement
A 'source' gets visited.

o  visitStrong: anElement

o  visitStyleElement: anElement

o  visitSub: anElement

o  visitSup: anElement

o  visitUnderlined: anElement
An underlined gets visited.

o  visitVar: anElement

o  visitVideo: anElement
A 'video' 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: anElement
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: anElement

o  visitLink: aLink
A link gets visited.

o  visitMeta: aMeta
A meta element gets visited.

o  visitQuotation: element
A q gets visited.

o  visitScript: aScript
A script gets visited.

o  visitStyle: aStyle
A style element gets visited.

o  visitTime: el
A time 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: anElement
A code gets visited.

o  visitImage: anImage
An image gets visited.

o  visitNoBr: anImage
A noBr gets visited.

o  visitObject: anImage
An object gets visited.

o  visitSpan: anElement
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 must be redefined in concrete classes (subclassResponsibility) **

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

** This method must be redefined in concrete classes (subclassResponsibility) **

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 21 Nov 2024 12:32:38 GMT