if (xsterm instanceof XSElementDeclaration)
{
// FIXME This is horribly wrong, but too much depends on this broken behavior
buf.append("<sequence>");
XSElementDeclaration xsel = (XSElementDeclaration)xsterm;
buf.append(this.write(xsel, xsp));
buf.append("</sequence>");
}
else if (xsterm instanceof XSModelGroup)
{
XSModelGroup jmg = (XSModelGroup)xsterm;
XSObjectList objlist = jmg.getParticles();
String end = null;
switch (jmg.getCompositor())
{
case XSModelGroup.COMPOSITOR_ALL:
buf.append("<all>");
end = "</all>";
break;
case XSModelGroup.COMPOSITOR_CHOICE:
buf.append("<choice>");
end = "</choice>";
break;
default:
case XSModelGroup.COMPOSITOR_SEQUENCE:
buf.append("<sequence>");
end = "</sequence>";
break;
}
int lenobj = objlist != null ? objlist.getLength() : 0;
for (int i = 0; i < lenobj; i++)
{
XSParticle jxsp = (XSParticle)objlist.item(i);
XSTerm xterm = jxsp.getTerm();
if (xterm instanceof XSElementDeclaration)
{
XSElementDeclaration xsel = (XSElementDeclaration)jxsp.getTerm();
buf.append(this.write(xsel, jxsp));
}
else if (xterm instanceof XSModelGroup)
{
if (deriveMethod == XSConstants.DERIVATION_EXTENSION && i != lenobj - 1)