eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'XMLStandardDecoder':

Home

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

Class: XMLStandardDecoder


Inheritance:

   Object
   |
   +--XML::SAXDriver
      |
      +--XMLStandardDecoder

Package:
stx:goodies/xml/stx
Category:
XML-Presentation
Version:
rev: 1.36 date: 2018/02/02 16:38:56
user: cg
file: XMLStandardDecoder.st directory: goodies/xml/stx
module: stx stc-classLibrary: stx
Author:
Stefan Vogel (stefan@zwerg)

Description:


XMLStandardDecoder is used to decode the XML representation of objects encoded
with XMLStandardCoder


[instance variables:]
    idToObjectMapping   <Collection> Mapping from object ids to objects
    object              <Object>     The decoded object
    aspect              <String|nil> The aspect used to encode
    version             <String|nil> The version provided by the encoder
    stack               <Stack>      Stack of nested objects
    characterStream     <WriteStream>Stream to collect character data
    needWhitespace      <Bool>       true, when whitespace should be preserved for the
                                     current element
    useSend             <Bool>       If true, use #perform: instead of
                                     #instvarNamed:put: to build objects


[class variables:]


Related information:

    ObjectCoder
    XMLCoder
    XMLStandardCoder

Class protocol:

instance creation
o  on: readStream
redefine to switch off validation

o  on: readStream beforeScanDo: aBlock
redefine to switch off validation


Instance protocol:

accessing
o  aspect
return the value of the instance variable 'aspect' (automatically generated)

o  next
answer the next object from the stream.
Notice: VALID xml files contain only a single object.

o  object

o  useSend

o  useSend: aBoolean
if aBoolean is true, the decoder uses a message send to set the values of an object.
If aBoolean is false, the instance variables are set directly

o  version
return the value of the instance variable 'version' (automatically generated)

building
o  add: newObj toParent: parentObjectContainer with: currentObjectContainer
add an object to its parent object

o  remember: obj as: id
map an object id to an object.
We know here that object ids are consecutive integers starting at 1.
If this changes, we have to use a Dictionary instead of an OrderedCollection

o  valueForElementName: elementName class: classGiven size: sizeGiven
answer an object for a XML element name.
Only some primitive elements or containers may be resolved immediately.
Others need the elements text available only when the end tag is
being processed. In this case push a converter onto the stack and return 0

content handler
o  characters: aString
process xml character data.
If characters are separated by ignorable whitespace, this may
be called more than once for a single element

o  endElement: localName namespace: nameSpace prefix: nameSpacePrefix
end of xml element.
If stack is empty, this is the single top element.
Otherwise this is a subordinate element, that will be added
to its containing object

o  ignorableWhitespace: aString
got white space. We need all white space in strings and symbols

o  startDocument

o  startElement: localName namespace: namespace prefix: nameSpacePrefix attributes: attributes
aspect may be present only in the start element

error handler
o  error: anInvalidSignal
Called when a validating is on and parser reaches invalid XML. Is resumable
Also called when a class does not exist

o  fatalError: anXMLSignal
The XML parsers malformed and invalid signals are sent to this method

o  warning: aWarningSignal

initialization
o  initialize


Private classes:

    AbstractConverter
    Base64Converter
    CharacterConverter
    ContainedObject
    ContainedSequence
    NumberConverter
    StringConverter
    SymbolConverter

Examples:


Look at examples in XMLStandardCoder

ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 28 Mar 2024 15:13:11 GMT