|
Class: FastSAXDriver (in XML)
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
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).
initialization
-
initialize
-
(comment from inherited method)
called only once - initialize signals
instance creation
-
on: aStream
-
-
on: aStream beforeScanDo: aOneArgBlock
-
accessing
-
inStream: aStream
-
api
-
characterEncoding: encoding
-
use encoding to decode the stream's contents
-
characters: characters
-
self halt.
-
decodeAttributeValue: value
-
-
endElement: tag namespace: alwaysNil1 prefix: alwaysNil2
-
self halt.
-
startElement: tag namespace: alwaysNil1 prefix: alwaysNil2 attributes: attsOrNil
-
self halt.
api-dummy
-
builder
-
-
documentLocator: ignored
-
-
driver
-
-
tagPosition: aStreamPosition
-
can be redefined to remember the startPosition
-
validate: doValidate
-
error handling
-
parseError: message
-
parsing
-
on: aStream beforeScanDo: aOneArgBlock
-
passed as empty attributes collection
-
processingInstruction: tag attributes: attrDictionary
-
utf-8 is default per XML standard
-
readAttributeAndAddTo: attributesInDictionaryOrNil
-
read an attribute and add it to attributesInDictionaryOrNil.
If attributesInDictionaryOrNil is nil, create a new Dictionary
-
readElements
-
read xml elements.
-
readNextObject
-
process entity definitions and processing instructions
-
readQuotedValue
-
-
readTagOrAttributeName
-
a tag consists of:
alphaNumericWords separated by '_', '-', '.' or ':'s
-
unEscape: characters
-
hex code
-
upTo: aCharacter from: inStream
-
special tuning for the common case, when reading a string-stream
|decoder artefact|
decoder := NewXMLArtifactDecoder
on:(theArtifact at:2) asString readStream
beforeScanDo:[:parser |
parser builder driver dataBase:self.
parser validate:false
].
artefact := decoder decodedObject.
|