Andrej Zachar - 2005-08-31

Logged In: YES
user_id=1144405

I have add some code to handle with set, could you give me
right acces to cvs?

// MAW 08-13-02
// Added PropertyDescriptor as parameter to help
determine whether
// the class name needs to be written as an attribute.
protected void outputObject(String rawTagName, Object ob,
Class propClass)
throws IOException
{
String namespace = ""; // FIXME: get namespace
String tagName = getTranslatedEntityName(rawTagName);
if (tagName == null)
{
if (elementCount == 0)
throw new IOException("Requested root tagname
'"+rawTagName+"' does not match DTD");
else
return;
}

// Write out the opening tag
AttributesImpl attributes = nullAttributes;

if (getConfig().getAtomsAsAttributes() || this.dtd != null)
{
attributes = outputPropertiesAsAttributes(tagName, ob);
}
if (getConfig().getWriteClassNames())
{
if (JOXUtils.needsClassName(ob, propClass) &&
getConfig().getWriteClassNames())
{
if (attributes == nullAttributes)
{
attributes = new AttributesImpl();
}
attributes.addAttribute(
"", //FIXME: namespace (and
qualified name)
getConfig().getClassNameAttribute(),
getConfig().getClassNameAttribute(),
"CDATA",
ob.getClass().getName());
}
}
this.startElement(namespace, tagName, tagName, attributes);

//NEW
CODE****************************************************************
if (ob instanceof Set) {
for (Iterator iter = ((Set) ob).iterator();
iter.hasNext();) {
Object realObject = iter.next();
this.outputObject(realObject.getClass().getSimpleName(),
realObject, realObject
.getClass());
}
}
//NEW
CODE****************************************************************
if (ob instanceof Map)
{
outputMapAsElements(tagName, (Map) ob);
}
else if (ob instanceof Dictionary)
{
outputDictAsElements(tagName, (Dictionary) ob);
}
else
{
// Write out the properties of the object
outputPropertiesAsElements(tagName, ob);
}

// Write out the closing tag
this.endElement(namespace, tagName, tagName);
}