4.6.4 Deletion
A <text:deletion> element
contains content that was deleted while change tracking was enabled. The
position where the text was deleted is marked by the change position element.
If part of a paragraph was deleted, the text that was deleted
is contained in this element as a paragraph element. If the deleted text is
reinserted into the document, the paragraph is joined with the paragraph where
the deletion took place.
<define name="text-changed-region-content"
combine="choice">
<element
name="text:deletion">
<ref
name="office-change-info"/>
<zeroOrMore>
<ref
name="text-content"/>
</zeroOrMore>
</element>
</define>
Example: Deletion of text
<text:tracked-changes>
<text:changed-region
text:id="c002">
<text:deletion>
<office:change-info>
<dc:creator>Michael
Brauer</dc:creator>
<dc:date>1999-05-18T12:56:04</dc:date>
</office:change-info>
<text:p>,
but this has been deleted</text:p>
</text:deletion>
</text:changed-region>
</text:tracked-changes>
<text:p>
This is
the original text<text:change text:region-id="c002"/>.
</text:p>
This example shows:
�
Deleted text = , but this has been deleted
This text is contained in the <text:p> element within
the <text:deletion>
element.
�
Current text = This is the original text.
This text is contained in the <text:p> element at the
end of the example.
�
Original text before deletion took place = This
is the original text, but this has been deleted.
Note that the deleted text, like all text in the OpenDocument
format, is contained in a paragraph element. To reconstruct the original text,
this paragraph is merged with its surrounding. In other words, a deletion
consisting of only a single word would be represented as a paragraph containing
the word.
To reconstruct the text before the deletion took place, do:
� If
the change mark is inside a paragraph, insert the text content of the
<text:deletion> element as if the beginning <text:p> and final
</text:p> tags were missing.
� If
the change mark is inside a header, proceed as above, except adapt the end tags
to match their new counterparts.
� Otherwise,
simply copy the text content of the <text:deletion> element in place of
the change mark.
Example: Given the following change:
<text:changed-region text:id="example">
<text:deletion>
<office:change-info>...</office:change-info>
<text:p>Hello</text:p>
<text:p>World!</text:p>
</text:deletion>
</text:changed-region>
The first (and most common) case occurs if a change mark is
inside a regular paragraph:
<text:p>abc<text:change
text:id="example/>def</text:p>
To reconstruct the original text, the two <text:p>
elements are copied to replace the change mark, except the beginning and ending
tags are missing:
<text:p>abcHello</text:p>
<text:p>World!def</text:p>
If the change mark occurred inside a header, the same
procedure is followed, except the copied tags are adapted to make sure we still
have well-formed XML.
<text:h>abc<text:change
text:id="example/>def</text:h>
becomes:
<text:h>abcHello</text:h>
<text:h>World!def</text:h>
The third case occurs when a change occurs outside of a
paragraph. In this case, the deleted text is simply copied verbatim.
<text:p>abcdef</text:p>
<text:change text:id="example/>
<text:p>ghijkl</text:p>
This becomes:
<text:p>abcdef</text:p>
<text:p>Hello</text:p>
<text:p>World!</text:p>
<text:p>ghijkl</text:p>
If, in the first two cases, the deletion contains complete
paragraphs, then additional empty paragraphs must be put into the
<text:deletion> element to achieve the desired result.
The change that took place from
<text:p>abc</text:p>
<text:h>Hello</text:h>
<text:h>World!</text:h>
<text:p>def</text:p>
to
<text:p>abc<text:change
text:id="example/>def</text:p>
would be represented as:
<text:changed-region text:id="example">
<text:deletion>
<office:change-info>...</office:change-info>
<text:p/>
<text:h>Hello</text:h>
<text:h>World!</text:h>
<text:p/>
</text:deletion>
</text:changed-region>