5.2.2 References
The representation of references is modeled on the
XML representation of bookmarks. There are two types of reference marks, as
follows:
�
A point reference
A point reference marks a particular position in text and is represented by a
single <text:reference-mark> element.
�
A range reference
A range reference marks a range of characters in text and is represented by two
elements; <text:reference-mark-start> to mark
the start of the range and <text:reference-mark-end>
to mark the end of the range.
Every reference is identified by its name, which must be
unique. In a range reference, the start and end elements must use the same
reference name.
Point References
The <text:reference-mark>
element represents a point reference.
<define name="paragraph-content"
combine="choice">
<element
name="text:reference-mark">
<attribute
name="text:name">
<ref
name="string"/>
</attribute>
</element>
</define>
Range References
The <text:reference-mark-start>
and <text:reference-mark-end> elements
represent a range reference.
<define name="paragraph-content"
combine="choice">
<choice>
<element
name="text:reference-mark-start">
<attribute
name="text:name">
<ref
name="string"/>
</attribute>
</element>
<element
name="text:reference-mark-end">
<attribute
name="text:name">
<ref
name="string"/>
</attribute>
</element>
</choice>
</define>
In the OpenDocument schema, three elements are used to
represent references instead of one element because references represented as a
single XML element:
�
Cannot support overlapping references
�
Do not interact well with other elements
Take the following example:
Example: Overlapping range references
<text:p>
<text:reference-mark-start
text:name="first"/>This is an
<text:reference-mark-start
text:name="second"/>example of a sentence
<text:reference-mark-end
text:name="first"/>with overlapping references.
<text:reference-mark-end
text:name="second"/>
</text:p>
The example paragraph shows two references that cover the
following text:
|
reference �first�
|
�This is an example of a sentence�
|
|
reference �second�
|
�example of a sentence with overlapping references.�
|
This overlapping structure cannot be represented using a
single reference element to contain the referenced text. Similarly, a reference
spanning multiple paragraphs creates the same situation as two overlapping XML
elements, as does character formatting either starts or ends, but not both,
within the referenced text.