search = new TextNavigation("ReplaceDateTarget", doc);
// count the initial date field count. should be 1.
OdfContentDom contentDom = doc.getContentDom();
NodeList nodeList = contentDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
int i = nodeList.getLength();
OdfStylesDom styleDom = doc.getStylesDom();
nodeList = styleDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
i += nodeList.getLength();
// replace all the 3 "ReplaceDateTarget" to FixedDateField.
while (search.hasNext()) {
TextSelection item = (TextSelection) search.nextSelection();
FieldSelection fieldSelection = new FieldSelection(item);
//fieldSelection.replaceWithSimpleField(Field.FieldType.FIXED_DATE_FIELD);
fieldSelection.replaceWithSimpleField(Field.FieldType.DATE_FIELD); // 1
//fieldSelection.replaceWithSimpleField(Field.FieldType.TIME_FIELD); //3
i++;
}
nodeList = contentDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
int j = nodeList.getLength();
nodeList = styleDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
j += nodeList.getLength();
Assert.assertEquals(j, i);
doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
} catch (Exception e) {