///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private TableContentValidationElement getContentValidationEle() throws Exception {
Document ownerDocument = getOwnerDocument();
OdfElement contentRootElement = ownerDocument.getContentRoot();
TableContentValidationsElement validations = OdfElement.findFirstChildNode(
TableContentValidationsElement.class, contentRootElement);
if (validations == null) {
validations = (TableContentValidationsElement) OdfXMLFactory.newOdfElement(ownerDocument
.getContentDom(), OdfName.newName(OdfDocumentNamespace.TABLE, "content-validations"));
contentRootElement.insertBefore(validations, contentRootElement.getFirstChild());
}
String validationName = getOdfElement().getTableContentValidationNameAttribute();
TableContentValidationElement validationElement = null;
if (validationName != null) {
Node child = validations.getFirstChild();
while (child != null) {
TableContentValidationElement contentValidationElementRef = (TableContentValidationElement) child;
if (validationName.equals(contentValidationElementRef.getTableNameAttribute())) {
validationElement = contentValidationElementRef;
break;
}
}
} else {
String valName = "val" + String.format("d%06x", (int) (Math.random() * 0xffffff));
validationElement = validations.newTableContentValidationElement(valName);
getOdfElement().setTableContentValidationNameAttribute(valName);
}
return validationElement;
}