Note: DOM module is under construction.

Document Object Model (DOM)

Document Object Model (DOM) is an interface that allows programs to dynamically access and update the content, structure and style of documents. Its implementation in Matreshka has some minor but important changes:

  • string of Unicode characters is used to represent text segments in document, in contrast to 16-bit code unit used in DOM Core recommendation;
  • indexes of characters in strings and nodes in node lists follow Ada conventions, so starts from 1 not 0.

Memory management

All allocated memory belongs to DOM::Document object and released after destruction of this object.

Error handling

Matreshka uses XML.DOM.DOM_Error exception to report exceptions. Additional information can be retrieved from corresponding DOM::Document object with Error_Code and Error_String functions.

Visitor pattern support

Matreshka extends DOM API by providing support for "visitor" pattern. It includes two interface types, first (XML.DOM.Visitors.Abstract_Visitor) to be used to process nodes of DOM tree and second (XML.DOM.Visitors.Abstract_Iterator) to be used to construct iterators other DOM tree. Default implementation of iterator process all nodes (except DOM::Attr and their children nodes) of DOM tree starting from DOM::Document.

Last modified 4 years ago Last modified on Feb 25, 2014, 8:15:26 PM