|
|
Class: XMLParser (in XML)
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
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 initialization
-
initialize
-
XMLParser initialize
dialects
-
concreteClass
-
return the concrete parser class, per smalltalk dialect
instance creation
-
new
-
-
on: aStream
-
-
on: aStream protocol: protocolString name: name
-
-
parse: aString
-
##add -umejava
-
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.
-
parseDtdString: aStringOrStream
-
parse a dtd from a aStringOrStream
-
processDocumentInFilename: aFilename
-
-
processDocumentInFilename: aFilename beforeScanDo: aBlock
-
-
processDocumentStream: aStream
-
-
processDocumentStream: aStream beforeScanDo: aBlock
-
-
processDocumentString: aString
-
-
processDocumentString: aString beforeScanDo: aBlock
-
utilities
-
invalid: aString
-
-
malformed: aString
-
-
mapEncoding: anEncoding
-
-
warn: aString
-
Added to unify warnings for SAX. REW
DTD processing
-
conditionalSect
-
-
dtdEntry
-
-
dtdFile: newURI
-
-
dtdStream: aStream rootElement: rootElementNameString
-
set the DTD from the contents of aStream
-
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.
-
inInternalSubset
-
-
markUpDecl
-
-
notationDecl
-
-
pubIdLiteral
-
-
systemLiteral
-
-
uriResolver
-
IDs
-
checkUnresolvedIDREFs
-
-
rememberIDREF: anID
-
-
resolveIDREF: anID
-
accessing
-
builder
-
return the value of the instance variable 'builder' (automatically generated)
-
document
-
cg: added for twoFlower *compatibilitz with newer XMLParser framework
-
dtd
-
-
eol
-
-
isEncodeChecking
-
-
isEncodeChecking: aBoolean
-
-
isTreeBuilding
-
answer true, if we build a tree of xml elements.
This is false for SAX parsing
-
isTreeBuilding: something
-
-
normalizeDtd
-
-
normalizeDtd: something
-
-
sourceWrapper
-
-
validate: aBoolean
-
api
-
comment
-
-
docTypeDecl
-
-
latestURI
-
-
misc
-
-
parseDtd
-
parse a plain dtd
-
pi
-
-
prolog
-
-
pushSource: aStreamWrapper
-
-
scanDocument
-
MessageTally spyOn:[
attribute def processing
-
attListDecl
-
-
completeNotationType
-
-
defaultDecl
-
-
enumeration
-
attribute processing
-
attValue
-
-
attribute
-
-
isValidName: aTag
-
-
isValidNmToken: aTag
-
-
processAttributes
-
-
quotedString
-
-
validateAttributes: attributes for: tag
-
element def processing
-
completeChildren: str
-
-
completeMixedContent: str
-
we already have the #PCDATA finished.
-
contentsSpec
-
-
cp
-
-
elementDecl
-
element processing
-
charEntity: data startedIn: str1
-
parse a character entity and add it to data.
cg: separated into parsinf the entity and adding to the stream
-
closeTag: tag return: elements
-
-
completeCDATA: str1
-
-
completeComment: str1
-
-
completePI: str1
-
-
element
-
-
elementAtPosition: startPosition
-
-
elementContent: tag openedIn: str
-
-
generalEntityInText: str canBeExternal: external
-
-
isValidTag: aTag
-
-
parseCharEntityStartedIn: str1
-
parse a character entity.
cg: separated into parsing and separate adding to the stream
entity processing
-
PERef: refType
-
-
entityDecl
-
-
entityDef: entityName
-
Parameter entityName added for SAX. REW
-
entityValue
-
-
generalEntity: str
-
-
nDataDecl
-
^self skipSpaceInDTD
-
peDef: entityName
-
Parameter entityName added for SAX. REW
initialization
-
builder: anXMLNodeBuilder
-
-
lineEndLF
-
-
on: inputStream
-
-
on: inputStream protocol: protocolString name: name
-
-
wrapStream: aStream protocol: protocolString name: name
-
private
-
checkForWrongRootNode
-
-
closeAllFiles
-
-
documentNode
-
-
error: aStringOrMessage
-
-
expected: string
-
-
fullSourceStack
-
-
getDottedName
-
-
getElement
-
cg: added for twoFlower *compatibilitz with newer XMLParser framework
-
getQualifiedName
-
-
getSimpleName
-
-
invalid: aString
-
-
isValidNameChar: c
-
-
isValidNameStart: c
-
-
malformed: aString
-
-
nmToken
-
-
notPermitted: string
-
-
validateEncoding: encName
-
-
validateText: data from: start to: stop testBlanks: testBlanks
-
cg: added for twoFlower *compatibilitz with newer XMLParser framework
-
warn: aString
-
Modfied to unify warn system for SAX, REW
-
with: list add: node
-
streaming
-
atEnd
-
-
forceSpace
-
-
forceSpaceInDTD
-
-
getNextChar
-
-
mustFind: str
-
-
nextChar
-
avoid #atEnd if possible (let #next return nil)
-
skipIf: str
-
-
skipSpace
-
answer true, if whitespace was skipped
-
skipSpaceInDTD
-
-
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.
-
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
-
documentHasDTD
-
-
hasExpanded: anEntity
-
-
isIllegalCharacter: anInteger
-
answer true, if anInteger is an illegal unicode code point in an xml file
-
isValidating
-
-
shouldTestWFCEntityDeclared
-
|