return;
}
JavaQName STRING_TYPE = JavaQNameImpl.getInstance(String.class);
JavaQName ATTRIBUTES_TYPE = JavaQNameImpl.getInstance(Attributes.class);
JavaMethod jm = pSource.getMethod("startElement", new JavaQName[]{STRING_TYPE,
STRING_TYPE,
STRING_TYPE,
ATTRIBUTES_TYPE});
if (jm == null) {
throw new IllegalStateException("No such method: 'startElement' in '" + pSource.getQName() + "'.");
}
PlaceHolder placeHolder = jm.getPlaceHolder("GroupSG");
if (placeHolder == null) {
throw new IllegalStateException("No such placeholder: 'GroupSG' in method 'startElement'");
}
placeHolder.remove();
Parameter[] parameters = jm.getParams();
Parameter pNamespaceURI = parameters[0];
Parameter pLocalName = parameters[1];
Parameter pQName = parameters[2];
Parameter pAttr = parameters[3];
jm.addCase("1");
Set namespaces = new HashSet();
for (int i = 0; i < myParticles.length; i++) {
ParticleSG child = myParticles[i];
if (child.isGroup()) {
// TODO: Process group case properly
} else if (child.isWildcard()) {
throw new IllegalStateException("Wildcards aren't implemented yet.");
} else if (child.isElement()) {
namespaces.add(child.getObjectSG().getName().getNamespaceURI());
} else {
throw new IllegalStateException("Unknown particle type");
}
}
boolean firstNamespace = true;
for (Iterator iter = namespaces.iterator(); iter.hasNext(); ) {
String uri = (String) iter.next();
if ("".equals(uri)) {
jm.addIf(firstNamespace, pNamespaceURI, " == null || ", pNamespaceURI, ".length() == 0");
} else {
jm.addIf(firstNamespace, JavaSource.getQuoted(uri), ".equals(", pNamespaceURI, ")");
}
firstNamespace = false;
extendXMLHandlersStartElementMethodAddNamespace(pController, pHandlerVar, pStateVar,
jm, uri, pNamespaceURI,
pQName, pLocalName, pAttr,
myParticles);
}
if (!firstNamespace) {
jm.addElse();
}
jm.addLine("super.startElement(", pNamespaceURI, ", ", pLocalName, ", ", pQName, ", ", pAttr, ");");
if (!firstNamespace) {
jm.addEndIf();
}
jm.addBreak();
jm.addDefault();
jm.addIf(pHandlerVar, " == null");
jm.addLine("super.startElement(", pNamespaceURI, ", ", pLocalName, ", ", pQName, ", ", pAttr, ");");
jm.addElse();
jm.addLine(pHandlerVar, ".startElement(", pNamespaceURI, ", ", pLocalName, ", ", pQName, ", ", pAttr, ");");
jm.addEndIf();
}