Yulup Code Design Milestone 1

2006-08-07

Revision History
Revision 1.0 2006-08-07 AW
First initial draft.

Abstract

The Yulup code design for milestone 1.


Table of Contents

1. Overview
2. Classes and Interfaces
2.1. FRONTEND
2.1.1. BROWSER
2.1.1.1. General
2.1.1.1.1. MVC
2.1.1.2. Feature-Specific
2.1.2. STANDALONE
2.1.2.1. General
2.1.2.2. Feature-Specific
2.1.3. WEB
2.1.3.1. General
2.1.3.2. Feature-Specific
2.2. BACKEND
2.2.1. Generic
2.2.1.1. Bootstrapping the Back End
2.2.1.2. Base Functionality of the Back End
2.2.1.3. An Instance of a Document (XML, XSLT, CSS, Plain Text, ...)
2.2.1.4. A Container to Hold a Serialized File
2.2.1.5. Document Model
2.2.1.6. Document Controller
2.2.1.7. Facility to Communicate with the CMS
2.2.1.8. Editing XML Documents in WYSIWYG Mode with XSLT Applied
2.2.2. Feature-Specific
2.3. CONNECTOR
2.3.1. General
2.3.2. Feature-Specifc

Tagging source document with IDs

All elements in the source document are tagged with a unique ID by applying the sourcetagger.xsl stlyesheet.

For example, a source document

<foo>
  Some text.
  <bar>
    Hello.
  </bar>
  Some more text.
</foo>
              

would get transformed to

<foo _yulup-id="951">
  Some text.
  <bar _yulup-id="362">
    Hello.
  </bar>
  Some more text.
</foo>
              

Note that the IDs are semi-random and do not neither imply order nor nesting levels.

Creating a map of all elements

All elements are added into a map, consisting of ID/DOM node pairs.

For example:

951: ref to foo
362: ref to bar
              

Transforming for display

The source document is transformed into its XHTML version by applying its associated stylesheet, which was first appended to the idcopier.xsl stylesheet which contains a rule to copy the source element's unique ID everytime text is extracted from this element's content and inserted into the XHTML document.

The result is an XHTML document consisting of nodes with no IDs and nodes with possibly not unique IDs (e.g. if the text of one source element was used twice). For exmaple:

<html>
  <head>
    <title>A Static Title</title>
  </head>
  <body>
    <div>
      <span _yulup-id="951">Some text.</span>
      <emphasis><span _yulup-id="362">Hello.</span></emphasis>
      <span _yulup-id="951">Some more text.</span>
    </div>
  </body>
</html>
              

Creating a map of all tagged XHTML nodes

In order to propagate possible changes back to the source document, we first create a second map, mapping unique IDs to nodes using that ID. Since multiple nodes may be using the same ID in the XHTML form, this is a map consisting of ID/(list of DOM nodes) pairs.

For example:

951: [ref to "Some text." span] [ref to "Some more text." span]
362: [ref to "Hello." span]
              

Propagating the changes back to the source document

For all unique IDs in the XHTML node map, the children of the corresponding node in the source document are removed, and all nodes in the XHTML form bearing that ID added to that node in the source document.

After an assumed user modification like

<html>
  <head>
    <title>A Static Title</title>
  </head>
  <body>
    <div>
      <span _yulup-id="951">I've modified some text.</span>
      <emphasis><span _yulup-id="362">Hola.</span></emphasis>
      <span _yulup-id="951">I've modified some more text.</span>
    </div>
  </body>
</html>
              

this would result in the following source document:

<foo _yulup-id="951">
  I've modified some text.
  I've modified some more text.
</foo>
              

Unfortunately, this means that the complete <bar/> element is gone.