}
private void handleEndElementState(JavaMethod pJm, LocalJavaField pElement,
ParticleSG pParticle) throws SAXException {
if (pParticle.isElement()) {
ObjectSG oSG = pParticle.getObjectSG();
TypeSG childType = oSG.getTypeSG();
XsQName name = oSG.getName();
Object[] uriCondition;
if ("".equals(name.getNamespaceURI())) {
uriCondition = new Object[]{
getParamNamespaceURI(), " == null || ",
getParamNamespaceURI(), ".length() == 0"
};
} else {
uriCondition = new Object[]{
JavaSource.getQuoted(name.getNamespaceURI()), ".equals(",
getParamNamespaceURI(), ")"
};
}
pJm.addIf(uriCondition, " && ", JavaSource.getQuoted(name.getLocalName()),
".equals(", getParamLocalName(), ")");
JavaQName type;
TypedValue v = getParamResult();
if (childType.isComplex()) {
type = childType.getComplexTypeSG().getClassContext().getXMLInterfaceName();
if (isMixed) {
pJm.addLine(pElement, ".getContent().add(", v, ");");
} else {
pParticle.getPropertySG().addValue(pJm, pElement, v, type);
}
} else {
PropertySG pSG;
DirectAccessible element;
if (isMixed) {
LocalJavaField f = pJm.newJavaField(GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLInterfaceName()));
f.addLine("new ", GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLImplementationName()), "()");
PropertySGChain chain = ((PropertySGImpl) pParticle.getPropertySG()).getHeadOfChain();
PropertySGChain head = new PropertySGChainImpl(chain){
public String getXMLFieldName(PropertySG pController) throws SAXException {
return "_value";
}
public String getPropertyName(PropertySG pController) throws SAXException {
return "value";
}
};
pSG = new PropertySGImpl(head);
element = f;
} else {
pSG = pParticle.getPropertySG();
element = pElement;
}
createSimpleTypeConversion(pJm, childType, v,
oSG.getName().toString(),
pSG, element);
if (isMixed) {
pJm.addLine(pElement, ".getContent().add(", element, ");");
}
}