eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'XML::XMLParser':

Home

everywhere
www.exept.de
for:
[back]

Class: XMLParser (in XML)


Inheritance:

   Object
   |
   +--XML::XMLParser
      |
      +--XML::XMLParserStX

Package:
stx:goodies/xml/vw
Category:
XML-VW-Parsing
Version:
rev: 1.48 date: 2009/11/10 12:36:31
user: cg
file: XMLParser.st directory: goodies/xml/vw
module: stx stc-classLibrary: vw

Description:


This class represents the main XML processor in the system. This  XMLParser may be used as a validating or non-validating parser to scan and process an XML document and provide access to it's content and structure to a smalltalk application. This XMLParser tries to follow the guidelines laid out in the W3C XML Version 1.0 Recommendation, plus the XML Namespaces Recommendation.

Instance Variables:
	sourceStack     <XML.StreamWrapper>  stack of input streams that handles inclusion.
	hereChar        <Character>  the current character being parsed
	lastSource      <XML.StreamWrapper>  record of previous source used to check correct nesting
	currentSource   <XML.StreamWrapper>  current input stream (the top of sourceStack)
	documentNode    <XML.Document>  the document created by parsing
	dtd     <XML.DocumentType>  the document type definition for the current document
	unresolvedIDREFs        <Collection>  collection of IDREfs that have yet to be resolved; used for validation
	builder <XML.NodeBuilder>  node builder
	validating      <Boolean>  if true then the parse validates the XML
	ignore  <Boolean>  ?
	eol     <Character>  the end-of-line character in the source stream


Class protocol:

class initialization
o  initialize
XMLParser initialize

dialects
o  concreteClass
return the concrete parser class, per smalltalk dialect

instance creation
o  new

o  on: aStream

o  on: aStream protocol: protocolString name: name

o  parse: aString
##add -umejava

o  parseDtdAsPatterns: aStringOrStream
parse a document type from aStringOrStream.
Do not normalize the DTD patterns, so they can be used for type construction.
Answer a XML::DocumentType.

o  parseDtdString: aStringOrStream
parse a dtd from a aStringOrStream

o  processDocumentInFilename: aFilename

o  processDocumentInFilename: aFilename beforeScanDo: aBlock

o  processDocumentStream: aStream

o  processDocumentStream: aStream beforeScanDo: aBlock

o  processDocumentString: aString

o  processDocumentString: aString beforeScanDo: aBlock

utilities
o  invalid: aString

o  malformed: aString

o  mapEncoding: anEncoding

o  warn: aString
Added to unify warnings for SAX. REW


Instance protocol:

DTD processing
o  conditionalSect

o  dtdEntry

o  dtdFile: newURI

o  dtdStream: aStream rootElement: rootElementNameString
set the DTD from the contents of aStream

o  externalID: usage
Usage may be #docType, #entity, or #notation.
DocType is treated specially, since PE references are not allowed.
Notation is treated specially since the system identifier of the
PUBLIC form is optional.

o  inInternalSubset

o  markUpDecl

o  notationDecl

o  pubIdLiteral

o  systemLiteral

o  uriResolver

IDs
o  checkUnresolvedIDREFs

o  rememberIDREF: anID

o  resolveIDREF: anID

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

o  document
cg: added for twoFlower *compatibilitz with newer XMLParser framework

o  dtd

o  eol

o  isEncodeChecking

o  isEncodeChecking: aBoolean

o  isTreeBuilding
answer true, if we build a tree of xml elements.
This is false for SAX parsing

o  isTreeBuilding: something

o  normalizeDtd

o  normalizeDtd: something

o  sourceWrapper

o  validate: aBoolean

api
o  comment

o  docTypeDecl

o  latestURI

o  misc

o  parseDtd
parse a plain dtd

o  pi

o  prolog

o  pushSource: aStreamWrapper

o  scanDocument
MessageTally spyOn:[

attribute def processing
o  attListDecl

o  completeNotationType

o  defaultDecl

o  enumeration

attribute processing
o  attValue

o  attribute

o  isValidName: aTag

o  isValidNmToken: aTag

o  processAttributes

o  quotedString

o  validateAttributes: attributes for: tag

element def processing
o  completeChildren: str

o  completeMixedContent: str
we already have the #PCDATA finished.

o  contentsSpec

o  cp

o  elementDecl

element processing
o  charEntity: data startedIn: str1
parse a character entity and add it to data.
cg: separated into parsinf the entity and adding to the stream

o  closeTag: tag return: elements

o  completeCDATA: str1

o  completeComment: str1

o  completePI: str1

o  element

o  elementAtPosition: startPosition

o  elementContent: tag openedIn: str

o  generalEntityInText: str canBeExternal: external

o  isValidTag: aTag

o  parseCharEntityStartedIn: str1
parse a character entity.
cg: separated into parsing and separate adding to the stream

entity processing
o  PERef: refType

o  entityDecl

o  entityDef: entityName
Parameter entityName added for SAX. REW

o  entityValue

o  generalEntity: str

o  nDataDecl
^self skipSpaceInDTD

o  peDef: entityName
Parameter entityName added for SAX. REW

initialization
o  builder: anXMLNodeBuilder

o  lineEndLF

o  on: inputStream

o  on: inputStream protocol: protocolString name: name

o  wrapStream: aStream protocol: protocolString name: name

private
o  checkForWrongRootNode

o  closeAllFiles

o  documentNode

o  error: aStringOrMessage

o  expected: string

o  fullSourceStack

o  getDottedName

o  getElement
cg: added for twoFlower *compatibilitz with newer XMLParser framework

o  getQualifiedName

o  getSimpleName

o  invalid: aString

o  isValidNameChar: c

o  isValidNameStart: c

o  malformed: aString

o  nmToken

o  notPermitted: string

o  validateEncoding: encName

o  validateText: data from: start to: stop testBlanks: testBlanks
cg: added for twoFlower *compatibilitz with newer XMLParser framework

o  warn: aString
Modfied to unify warn system for SAX, REW

o  with: list add: node

streaming
o  atEnd

o  forceSpace

o  forceSpaceInDTD

o  getNextChar

o  mustFind: str

o  nextChar
avoid #atEnd if possible (let #next return nil)

o  skipIf: str

o  skipSpace
answer true, if whitespace was skipped

o  skipSpaceInDTD

o  upTo: aCharacter
Answer a subcollection from position to the occurrence (if any, exclusive) of anObject.
The stream is left positioned after anObject.
If anObject is not found answer everything.

o  upToAll: target
Answer a subcollection from the current position
up to the occurrence (if any, not inclusive) of target,
and leave the stream positioned before the occurrence.
If no occurrence is found, answer the entire remaining
stream contents, and leave the stream positioned at the end.
We are going to cheat here, and assume that the first
character in the target only occurs once in the target, so
that we don't have to backtrack.

testing
o  documentHasDTD

o  hasExpanded: anEntity

o  isIllegalCharacter: anInteger
answer true, if anInteger is an illegal unicode code point in an xml file

o  isValidating

o  shouldTestWFCEntityDeclared



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 23:24:16 GMT