AttributeType[] attrs = attrSet.getAttribute();
if( attrs != null ) {
for (int i = 0; i < attrs.length; i++) {
int n;
Attribute attr = (Attribute) attrSet.getAttribute(i);
Element attrNode = XmlUtil.appendChildNode(doc, attrSetNode, ATTRIBUTE);
XmlUtil.appendAttributeNode(attrNode, ID, attr.getAttributeID());
Element valueElement;
Value val;
if (attr.getType() == AttributeTypes.ATTR_ID) {
checkSingleValueListItem(attr);
val = (Value) attr.getValue(0);
valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
XmlUtil.appendAttributeNode(valueElement, ID, val.getValueID().intValue());
if (val.getValueID().intValue() == (int) ValueIds.OTHER && val.getValueLiteral() != null) {
// Add one more Attribute node with the same id.
Element attrOther = XmlUtil.appendChildNode(doc, attrSetNode,
ATTRIBUTE);
XmlUtil.appendAttributeNode(attrOther, ID, attr.getAttributeID());
Node v_e = XmlUtil.appendChildNode(doc, attrOther, VALUE);
XmlUtil.appendChildNode(doc, v_e, NAME, val.getValueLiteral());
}
} else if (attr.getType() == AttributeTypes.ATTR_IDS) {
for (n = 0; n < attr.getValue().length; n++) {
Value v_s = (Value) attr.getValue(n);
valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
XmlUtil.appendAttributeNode(valueElement, ID, v_s.getValueID().intValue());
}
} else if (attr.getType() == AttributeTypes.ATTR_TEXT) {
checkSingleValueListItem(attr);
val = (Value) attr.getValue(0);
valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
XmlUtil.appendChildNode(doc, valueElement, NAME, val.getValueLiteral());
/*
if( val.ValueId == (int)ValueIds.OTHER )
{
// Add another attribute node with the same attribute Id
Node attrOther = XmlUtil.AddChild(doc, attrSetNode, ATTRIBUTE);
XmlUtil.AddAttributeNode(doc, attrOther, ID, attr.AttributeId.ToString());
valueElement = XmlUtil.AddChild(doc, attrOther, VALUE);
XmlUtil.AddAttributeNode(doc, valueElement, ID, val.ValueId.ToString());
}
*/
} else if (attr.getType() == AttributeTypes.ATTR_TEXT_DATE) {
checkSingleValueListItem(attr);
val = (Value) attr.getValue(0);
valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
XmlUtil.appendAttributeNode(valueElement, ID, val.getValueID().intValue());
addDateToValueNode(valueElement, val.getValueLiteral());
} else {
// Unsupported attribute type.
for (n = 0; n < attr.getValue().length; n++) {
//foreach(IValue v_o in attr.ValueList )
Value v_o = (Value) attr.getValue(n);
valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
XmlUtil.appendChildNode(doc, valueElement, NAME, v_o.getValueLiteral());
if (v_o.getValueID() != null && v_o.getValueID().intValue() != 0) {
XmlUtil.appendAttributeNode(valueElement, ID, v_o.getValueID().toString());
}