eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'XML::FastSAXDriver':

Home

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

Class: FastSAXDriver (in XML)


Inheritance:

   Object
   |
   +--XML::FastSAXDriver

Package:
stx:goodies/xml/stx
Category:
XML-STX-SAX
Version:
rev: 1.33 date: 2018/10/09 10:43:52
user: cg
file: XML__FastSAXDriver.st directory: goodies/xml/stx
module: stx stc-classLibrary: stx
Author:
Claus Gittinger

Description:


A stripped-down, but much faster abstract superclass for XML-Parsers.
To use: subclass from this (FastSAXDriver) instead of from SAXDriver.
(whitebox API is the same).

Disadvantages:
    no namespaces;
    no defined entities;
    ignores processing instructions
    all hard coded.
    treats '.' and ':' as alpha-characters within a tag.

Advantages:
    super fast


Use at your own risk, and only for XML which is known to be valid (i.e., your own).


Class protocol:

initialization
o  initialize
(comment from inherited method)
called only once - initialize signals

instance creation
o  on: aStream

o  on: aStream beforeScanDo: aOneArgBlock


Instance protocol:

accessing
o  inStream: aStream

api
o  characterEncoding: encoding
use encoding to decode the stream's contents

o  characters: characters
self halt.

o  decodeAttributeValue: value

o  endElement: tag namespace: alwaysNil1 prefix: alwaysNil2
self halt.

o  startElement: tag namespace: alwaysNil1 prefix: alwaysNil2 attributes: attsOrNil
self halt.

api-dummy
o  builder

o  documentLocator: ignored

o  driver

o  tagPosition: aStreamPosition
can be redefined to remember the startPosition

o  validate: doValidate

error handling
o  parseError: message

parsing
o  on: aStream beforeScanDo: aOneArgBlock
passed as empty attributes collection

o  processingInstruction: tag attributes: attrDictionary
utf-8 is default per XML standard

o  readAttributeAndAddTo: attributesInDictionaryOrNil
read an attribute and add it to attributesInDictionaryOrNil.
If attributesInDictionaryOrNil is nil, create a new Dictionary

o  readElements
read xml elements.

o  readNextObject
process entity definitions and processing instructions

o  readQuotedValue

o  readTagOrAttributeName
a tag consists of:
alphaNumericWords separated by '_', '-', '.' or ':'s

o  unEscape: characters
hex code

o  upTo: aCharacter from: inStream
special tuning for the common case, when reading a string-stream


Examples:


|decoder artefact| decoder := NewXMLArtifactDecoder on:(theArtifact at:2) asString readStream beforeScanDo:[:parser | parser builder driver dataBase:self. parser validate:false ]. artefact := decoder decodedObject.

ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sun, 17 Jan 2021 18:58:55 GMT