LOM

From LMNLWiki

This is a proposal by John Cowan. It is rooted in XOM rather than DOM, as I think XOM is a better design. It's also designed around classes, not interfaces, although in some languages an interface-based implementation might be better.

Needs to be updated to change Ranges into sets.

LOM is a whole-document LMNL Object Model. It's meant for practical use; don't confuse it with the LMNL data model.

See also Parser interface.

Node: the abstract parent class of almost everything else.

class Node {
   readonly Document property Document
   
   Node method copy()                       # deep copy
   method detach()                          # remove from owner
   method equal(Object obj)
   integer hashCode
   String method toString                   # short text for debugging
   String method toLMNL                     # serialize in LMNL syntax
}

Document: a whole document, carrying the Limen of the main text and the overall base URI.

class Document : Node {
   String property baseURI
   Limen property value
}

Limen: contains content and ranges; you can view the content in a variety of ways, and manipulate it as such.

class Limen : Node {
   readonly Node property owner

   # Manipulate content as child nodes
   Node method getChild(integer i)
   method setChild(integer i, Node newchild)
   method insertChild(integer i, Node newchild)
   method appendChild(Node newchild)
   method removeChild(integer i)
   method removeChild(Node child)
   method replaceChild(integer i, Node newchild)
   method replaceChild(Node child, Node newchild)
   integer method getChildCount()

   # Manipulate content as text (uses #xFFFD for non-character atoms)
   String method getText(integer start, integer end)
   method setText(integer start, integer end, String newtext)
   method insertText(integer point, String newtext)
   method appendText(String newtext)
   method removeText(integer start, integer end)
   method replaceText(integer start, integer end, String newtext)
   integer method length()

   # Manipula