// Handle elements
boolean hasJvmOptions = false;
boolean hasEnvironmentVariables = false;
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader, expectedNs);
final Element element = Element.forName(reader.getLocalName());
switch (element) {
case HEAP: {
parseHeap(reader, address, updates);
break;
}
case PERMGEN: {
parsePermgen(reader, address, updates);
break;
}
case STACK: {
parseStack(reader, address, updates);
break;
}
case AGENT_LIB: {
parseAgentLib(reader, address, updates);
break;
}
case AGENT_PATH: {
parseAgentPath(reader, address, updates);
break;
}
case JAVA_AGENT: {
parseJavaagent(reader, address, updates);
break;
}
case ENVIRONMENT_VARIABLES: {
if (hasEnvironmentVariables) {
throw MESSAGES.alreadyDefined(element.getLocalName(), reader.getLocation());
}
updates.add(Util.getWriteAttributeOperation(address, JVMHandlers.JVM_ENV_VARIABLES,
CommonXml.parseProperties(reader, expectedNs)));
hasEnvironmentVariables = true;
break;
}
case JVM_OPTIONS: {
if (hasJvmOptions) {
throw MESSAGES.alreadyDefined(element.getLocalName(), reader.getLocation());
}
parseJvmOptions(reader, address, expectedNs, updates);
hasJvmOptions = true;
break;
}