|
Class: FastSAXDriver (in XML)
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
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).
copyrightCOPYRIGHT (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 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
-
actually, I am abstract; should be redefined
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
-
recursively read xml elements.
-
readNextObject
-
process entity definitions and processing instructions
-
readQuotedValue
-
-
readTagOrAttributeName
-
a tag consists of:
alphaNumericWords separated by '_', '-', '.' or ':'s
-
unEscape: someCharacters
-
hex code
|decoder artefact|
decoder := NewXMLArtifactDecoder
on:(theArtifact at:2) asString readStream
beforeScanDo:[:parser |
parser builder driver dataBase:self.
parser validate:false
].
artefact := decoder decodedObject.
|