A DOM parser allows you to represent your XML document as a tree of nodes in your program. The DOM provides a common way of accessing general data structures from structured documents. A DOM parser can be used to process an XML file in Smalltalk.
The DOM standard is a W3C standard which describes mechanisms for software developers and Web script authors to access and manipulate parsed XML (and HTML) content. The DOM is platform- and language-neutral.
The DOM presents documents as a hierarchy of node objects that also implement other, more specialized interfaces. Methods that are part of the Document Object Model are saved in the AbtDOM-API category. The DOM API is documented at http://www.w3.org/TR/1999/CR-DOM-Level-2-19991210/core.html.
Use the DOM parser (AbtXmlDomParser) to read an XML file and return a representation of the file as a tree of objects. Most objects are subclasses of AbtDOMNode. You can then traverse the document tree and execute actions on the tree structure.
The VisualAge Smalltalk XML DOM parser is actually a SAX-2 parser which supplies an event handler for constructing DOM objects. Currently, VisualAge Smalltalk supports the core interfaces of DOM level-2.
The following table lists the Smalltalk classes that implement the
interfaces from DOM level-2:
Interface | Smalltalk implementor |
---|---|
Attr | AbtDOMAttr |
CDATASection | AbtDOMCDataSection |
Comment | AbtDOMComment |
Document | AbtDOMDocument |
DocumentFragment | AbtDOMDocumentFragment |
DocumentType | AbtDOMDocumentType |
DOMImplementation | AbtDOMImplementation |
DOMString | String |
Element | AbtDOMElement |
Entity | AbtDOMEntity |
Entity Reference |
AbtDOMEntityReference
|
DOM Exception | SgmlException |
Named Node Map | AbtDOMNamedNodeMap |
Node | AbtDOMNode |
Node List |
AbtDOMNodeList
|
Notation | AbtDOMNotation |
Processing Instruction | AbtDOMProcessingInstruction |
The VisualAge Smalltalk DOM parser deviates from the DOM level-2 specification as follows: