return result;
}
public static DefinitionType parseDefinitionType(String name, String html) {
ObjectFactory of = new ObjectFactory();
DefinitionType result = new DefinitionType();
result.setName(name);
int pos = html.indexOf('<');
while (pos != -1) {
if (pos != 0)
result.getContent().add(parseHTML(html.substring(0, pos)));
html = html.substring(pos);
if (html.startsWith("<i>") || html.startsWith("<b>")) {
ParsePosition pp = new ParsePosition(0);
HypertextType inner = parseHypertextType(html.substring(3), pp);
if (!html.substring(pp.getIndex() + 3, pp.getIndex() + 7).equals("</" + html.substring(1, 3)))
throw new RuntimeException("Start " + html.substring(0, 3) + " was closed by " + html.substring(pp.getIndex() + 3, pp.getIndex() + 7));
if (html.startsWith("<b>")) {
result.getContent().add(of.createDefinitionTypeBold(inner));
} else {
result.getContent().add(of.createDefinitionTypeItalic(inner));
}
html = html.substring(pp.getIndex() + 7);
} else if (html.startsWith("<br />")) {
result.getContent().add(of.createDefinitionTypeNewLine(of.createEmptyType()));
html = html.substring(6);
} else if (html.startsWith("<a href=\"appendix-") && html.startsWith(".html\">", "<a href=\"appendix-".length() + 1)) {
html = html.substring("<a href=\"appendix-".length());
DefinitionType.AppendixReference app = of.createDefinitionTypeAppendixReference();
app.setLetter(html.substring(0, 1));
html = html.substring(".html\">".length() + 1);
pos = html.indexOf("</a>");
app.setTitle(parseHTML(html.substring(0, pos)));
html = html.substring(pos + 4);
result.getContent().add(of.createDefinitionTypeAppendixReference(app));
} else {
throw new RuntimeException("Unparsable: " + html);
}
pos = html.indexOf('<');
}
if (html.length() > 0)
result.getContent().add(parseHTML(html));
return result;
}