try
{
Object parent = stack.getLast();
if (!(parent instanceof Configuration))
{
DefaultConfiguration config =
new DefaultConfiguration("property", "property");
config.setValue(value != null ? value.toString() : "");
config.setAttribute("name", parent.toString());
config.setAttribute(XML_SPACE, PRESERVE);
stack.removeLast();
stack.add(config);
}
if (parent instanceof DefaultConfiguration
&& value instanceof Configuration)
{
((DefaultConfiguration) parent).addChild((Configuration) value);
}
else if (
parent instanceof DefaultConfiguration
&& !(value instanceof Configuration))
{
DefaultConfiguration config =
new DefaultConfiguration("string", "string");
config.setValue(value.toString());
config.setAttribute(XML_SPACE, PRESERVE);
((DefaultConfiguration) parent).addChild(config);
}
}
catch (NoSuchElementException e)
{}