private void parseElementBody(String text, GroupSchemaNode parent, DatabaseSchema schema) throws org.dbwiki.exception.WikiException {
String elementBody = text;
if (elementBody.length() == 0) {
throw new WikiSchemaException(WikiSchemaException.SyntaxError, "Empty element definition for " + parent.label());
}
while (elementBody.length() > 0) {
if (elementBody.startsWith(attributeIndicator)) {
int posDelim = elementBody.indexOf(attributeDelimiter);
String attributeName = null;
if (posDelim != -1) {
attributeName = elementBody.substring(attributeIndicator.length(), posDelim).trim();
elementBody = elementBody.substring(posDelim + attributeDelimiter.length()).trim();
if (elementBody.length() == 0) {
throw new WikiSchemaException(WikiSchemaException.SyntaxError, "Empty element definition in " + text);
}
} else {
attributeName = elementBody.substring(attributeIndicator.length()).trim();
elementBody = "";
}
AttributeSchemaNode attribute = new AttributeSchemaNode(schema.size(), attributeName, parent);
if (!DatabaseSchema.isValidName(attribute.label())) {
throw new WikiSchemaException(WikiSchemaException.SyntaxError, "Invalid attribute name " + attributeName + " in " + text);
}
schema.add(attribute);
} else if (elementBody.startsWith(elementIndicator)) {
int posDelim = this.findEndOfElement(elementBody);
if (posDelim != -1) {
this.parseElement(elementBody.substring(0, posDelim + closeElement.length()), parent, schema);
elementBody = elementBody.substring(posDelim + closeElement.length()).trim();
} else {
throw new WikiSchemaException(WikiSchemaException.SyntaxError, "Invalid element body " + text);
}
} else {
throw new WikiSchemaException(WikiSchemaException.SyntaxError, "Invalid element body " + text);
}
}
}