Skip to main content
Jump to: navigation, search


< Vex
Revision as of 11:24, 9 January 2013 by (Talk | contribs) (XML Structure Representation)

The Document Object Model

Vex's domain model representing an XML document consists of two parts: the XML structure and the textual content.

XML Structure Representation

The XML structure is represented by the Document Object Model (DOM).


Each Node is associated with a range in the representation of the textual content. A Parent node can have other nodes as children.

Text Representation

The textual content of an XML document is managed through the Content interface. One Content instance contains the whole textual content of one document or document fragment. The textual information is enriched with (so called) 'tag markers', which mark the position of XML structual elements (e.g. the start and end tags of XML elements) within the textual content.

Textual content is also presented in the structure representation in form of Text nodes. Those nodes provide a pointer into the Content instance.


To modify an XML document, Vex provides operations on several levels of granularity.

Level 0: Basic Operations

The lowest level contains only the very basic operations to modify the XML structure and the textual content. Those operations are spread over the DOM and the Content interface. They do not ensure wellformedness or validity of the XML document.

L0 operations are intented to be used only internally! They are not part of Vex's public API.

Level 1: Generic XML Operations

Level one contains the operations to generically modify an XML document according to its document type. The operations on this level do ensure wellformedness and, if a document type is available, validity.

The class Document provides all L1 operations:

  • canInsertText(offset)
  • insertText(offset, String)
  • canInsertElement(offset, QualifiedName)
  • insertElement(offset, QualifiedName)
  • canInsertComment(offset)
  • insertComment(offset)
  • canInsertFragment(offset, DocumentFragment)
  • insertFragment(offset, DocumentFragment)
  • canInsertProcessingInstruction(offset, ?) (still to be done)
  • insertProcessingInstruction(offset, ?) (still to be done)
  • canInsertCDataSection(offset, ?) (still to be done)
  • insertCDataSection(offset, ?) (still to be done)
  • canInsertEntityReference(offset, ?) (still to be done)
  • insertEntityReference(offset, ?) (still to be done)
  • delete(ContentRange)
  • getFragment(ContentRange)
  • getValidInsertElements(offset)
  • getNodeForInsertion(offset)
  • findCommonNode(offset1, offset2)

Level 2: XML Editing

The second level contains operations to edit an XML document based on a cursor or selection. The operations can be undone and redone, several operations can be combined into one atomic compound operation. The L2 operations have a one-to-one relationship to the basic editing actions present on the UI of Vex.

Level 3: Semantic XML Operations

The semantic XML operations provide functionality for a specific document type or sub-structure of an XML document on a semantic level. Editing of tables according to the CALS table model would be an example of such semantic operations.

Back to the top