public class ConversionUtil {
public static Element createValueElement(String title, String value, Metadata metadata, Element rootElement) {
Element element = new DefaultElementImpl(metadata, rootElement);
element.setName(title);
List elementValues = new ArrayList();
Element valueElement = new ValueElementImpl(metadata, element);
//Attributes
List attributes = new ArrayList();
Attribute attribute = AttributeImpl.createValueAttributeInstance(element, AttributeTypeEnum.STRING_TYPE);
attribute.setValue(value);
attributes.add(attribute);
valueElement.setAttributes(attributes);
elementValues.add(valueElement);
element.setElements(elementValues);
return element;
}