{
attributeList.addNamespaceDeclaration("autoGenNs", entryNamespace);
}
}
final UserDefinedAttribute userDefinedAttribute = (UserDefinedAttribute) entryValue;
final String valueType;
final String value;
final Object o = userDefinedAttribute.getValue();
if (o instanceof Time)
{
valueType = "time";
final SimpleDateFormat sdf = new SimpleDateFormat("'PT'HH'H'mm'M'ss'S'");
value = sdf.format(o);
}
else if (o instanceof Date)
{
valueType = "date";
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss' 'z");
value = sdf.format(o);
}
else if (o instanceof Number)
{
value = o.toString();
valueType = "float";
}
else if (o instanceof Boolean)
{
value = o.toString();
valueType = "boolean";
}
else if (o != null)
{
value = o.toString();
valueType = "string";
}
else
{
return;
}
attributeList.setAttribute(ODFMetaAttributeNames.Meta.NAMESPACE, "name", userDefinedAttribute.getName());
attributeList.setAttribute(ODFMetaAttributeNames.Office.NAMESPACE, "value-type", valueType);
writer.writeTag(entryNamespace, entryName, attributeList, XmlWriterSupport.OPEN);
writer.writeTextNormalized(value, false);
writer.writeCloseTag();
}