eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'XML::Document':



Class: Document (in XML)



rev: 1.23 date: 2023/10/06 19:38:28
user: stefan
file: Document.st directory: goodies/xml/vw
module: stx stc-classLibrary: vw


This class represents an XML document entity and serves as the root of the document entity tree. Each XML document has one entity (root) called the document entity, which serves as the starting point for the XML processor and may contain the whole document (nodes collection). 

According to the XML 1.0 specification, XML documents may and should begin with an XML declaration which specifies the version of XML (xmlVersion instance variable) being used. 

The XML document type declaration which must appear before the first element in a document contains or points to markup declarations that provide the grammar for this document. This grammar is known as document type definition (dtd instance variable). An XML document is valid if it has an associated document type declaration and if the document complies with the constraints expressed in it. If the document type declaration is not present, the document can be at most well formed.

Instance Variables:
	root    <XML.Node>  
	nodes   <Collection>  
	xmlVersion      <String>  
		Version of the XML specification to which the document is conformant
	dtd     <XML.DocumentType>
		Associated document type definition 
	ids     <Dictionary>  

Class protocol:

instance creation
o  new
(comment from inherited method)
return an instance of myself without indexed variables

Instance protocol:

o  atID: key ifAbsent: aBlock

o  registerID: attribute from: aParser

o  updateIDs

o  / elementName
XPath like access to the root element

o  // elementName
XPath like access to all subelements named elementName

o  addNamespaceDefinitions

o  addNode: aNode

o  document

o  dtd

o  dtd: aDTD

o  elements

o  pathName

o  root

o  selectNodes: aBlock

o  xmlVersion

o  xmlVersion: aString

o  = anXmlDocument
(comment from inherited method)
return true if the receiver and the arg have the same structure.
This method is partially open coded (inlined) by the compiler(s)
identical objects are always considered equal.
redefining it may not work as expected.

o  hash
(comment from inherited method)
return an Integer useful as a hash key for the receiver.
This hash should return same values for objects with same
contents (i.e. use this to hash on structure)

o  cloneTree
answer a copy of the tree, so that removal of child elements
from the copy does not affect the original node.

o  nodesDo: aBlock
evaluate aBlock for me and all element nodes

o  nodesReverseDo: aBlock
evaluate aBlock for me and then recurively or children in reverse order

o  treePosition
answer a SequencableCollection which holds the position of the node
in the document tree

o  hasDTD

o  hasExternalDTD

o  noteDTD

o  noteExternalDTD

o  notePEReference

o  usesParameterEntities

o  initialize
(comment from inherited method)
just to ignore initialize to objects which do not need it

o  prettyPrintOn: aStream
(comment from inherited method)
depth should be named indent

o  printCanonicalOn: aStream
no version header in canonical XML;

o  printHTMLOn: aStream
(comment from inherited method)
Print myself on the stream in a form usual for HTML.

o  printHeaderOn: aStream

o  printNoIndentOn: aStream endSpacing: endSpacingBlock spacing: spacingBlock
(comment from inherited method)
Print myself on the stream with line breaks between adjacent
elements, but no indentation.

o  printOn: aStream
(comment from inherited method)
self printAsOneLineOn: aStream

private helpers
o  treePositionOf: aNode
return a collection containing the position of the node in the document

o  hasSubNodes

o  isContent

o  isDocument

o  verifyContents

o  acceptVisitor: aVisitor
Double dispatch back to the visitor, passing my type encoded in
the selector (visitor pattern)

ST/X; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 26 May 2024 12:55:48 GMT