eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTML::Encoder':

Home

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

Class: Encoder (in HTML)


Inheritance:

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

Package:
stx:goodies/webServer/htmlTree
Category:
Net-Documents-HTML-TreeBuilder
Version:
rev: 1.108 date: 2024/03/07 18:25:04
user: cg
file: HTML__Encoder.st directory: goodies/webServer/htmlTree
module: stx stc-classLibrary: htmlTree

Description:


This encodes the HTML DOM elements as a string.

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.

Class protocol:

instance creation
o  new
Create a new encoder.
Build the necessary stream.

o  on: aStream
Create an encoder on a stream.


Instance protocol:

accessing
o  generateCharEscapes: aBoolean
if true, any non-ascii chars in the output will be escaped as HTML character
entities (&#xxxx;)
if false, the output will be as is iff the output stream accepts wide chars,
or utf8-encoded if not.

o  generateCompactOutput: aBoolean
if true, the output is not prettyprinted;
if false, it is indented

o  htmlString
Return the html string.
Call this after doing a '#visit:'.

o  stream
Return the stream the encoder encodes on.

o  stream: aStream

initialization
o  initialize
Set the indent depth to a default.
Attention: Direct instance variable
access relies on this setting

private-accessing
o  setStream: aStream
Set a stream as the stream to print on.
Private - Use only for instance creation.

private-printing
o  attributeValuesPrintString: aRawObject
Print an attribute value or a list of attribute values.
aRawObject can be a string, a style object or a collection of those.

o  printAttribute: anAssociation
Print a single attribute given as an association
with key and value onto a stream.

The value sometimes can be a collection of values.

o  printAttributesOf: anElement
Print all set attributes of an
item onto the stream.

Attributes can be nil for no
attributes which is the default.

Otherwise will be key value pairs.
They are representated as 'key=value' in HTML.

o  printNewLineIndent
Print a carriage return and an indent
of length indent onto the stream,
but only if there is no inlining.

New line and indent are always printed
together. There is no newline without
indenting and no intenting witout a new
line.

o  printScriptElement: aScriptElement
A script element gets printed.

o  printStyleElement: aStyleElement
A style element gets printed.

private-printing-tags
o  printInline: anElement
An element gets printed inline.

o  printSingle: anElement
Print an element without contents.
Do not use '<tag/>' or '<tag />', because it is not valid HTML 4.01,
(the first one is valid only in XHTML).

o  printSingle: anElement withSpace: withSpace
Print an element without contents.
Ignore withSpace, since it produces invalid HTML code.

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

o  printTagsFor: anElement do: aBlock
Print both tags for an element and evaluate a block which
is printing other data between the tags.

private-queries
o  areChildrenSimpleOf: element

visiting
o  visitSubelement: aSubElement
Visit a subelement.
Care for indent and newlines

o  visitSubelement: aSubElement indent: doIndent
Visit a subelement.
Care for indent and newlines

o  visitSubelementsOf: anElement
Visit the subelements of an element.

Usage example(s):

self visitSubelementsOf:anElement indent:wantIndent.

o  visitSubelementsOf: anElement indent: wantIndent
Visit the subelements of an element.

visiting - required
o  visitComment: aComment
(comment from inherited method)
A comment gets visited.

o  visitElement: anElement
The task of this encoder is to print html code.
So print a default version of every item of the tree.

o  visitProcessingInstruction: aProcessingInstruction
(comment from inherited method)
A processing instruction gets visited.

o  visitString: aString
A string gets visited.
We like to print it onto our stream.
The stream MUST handle wide chars!

visiting-BlockLevel
o  visitDiv: aDiv
(comment from inherited method)
A div gets visited.

visiting-Form
o  visitOption: anOptionElement
(comment from inherited method)
An option gets visited.

o  visitTextArea: anInput
A textarea gets visited.

visiting-Head
o  visitScript: aScript
A script gets visited.

o  visitStyle: aStyle
A style element gets visited.

o  visitStyleElement: anElement

o  visitTitle: aTitle
A title element gets visited.

visiting-Inline
o  visitAnchor: anAnchor
(comment from inherited method)
An anchor gets visited.

o  visitArea: anArea

o  visitBreak: aLineBreak
(comment from inherited method)
A line break gets visited.

o  visitInput: anInput
(comment from inherited method)
An input gets visited.

o  visitObject: anInput
(comment from inherited method)
An object gets visited.

visiting-ListDefinition
o  visitDefinitionTerm: aTerm
A definition term gets visited.

visiting-Table
o  visitTableDataCell: aTableDataCell
(comment from inherited method)
A table data cell gets visited.

o  visitTableHeaderCell: aTableHeaderCell
(comment from inherited method)
A table header cell gets visited.

visiting-TopLevel
o  visitDocument: aDocument
A document gets visited.
Redefined to display the document type if existent.



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 22 Dec 2024 02:24:12 GMT