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.43 date: 2024/04/23 19:07:02
user: cg
file: XML__FastSAXDriver.st directory: goodies/xml/stx
module: stx stc-classLibrary: stx

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).

copyright

COPYRIGHT (c) 2007 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:

class 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
actually, I am abstract; should be redefined

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
recursively 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: someCharacters
hex code


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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:17:27 GMT