throws IOException, SAXException, ParserConfigurationException
{
content.clear();
final Document doc = DOMUtilities.parseInputStream(in);
final Element e = doc.getDocumentElement();
final NodeList list = e.getElementsByTagName("key"); //$NON-NLS-1$
for (int i = 0; i < list.getLength(); i++)
{
final Element keyElement = (Element) list.item(i);
final String keyName = keyElement.getAttribute("name"); //$NON-NLS-1$
final boolean keyGlobal = "true".equals(keyElement.getAttribute("global")); //$NON-NLS-1$
final boolean keyHidden = "true".equals(keyElement.getAttribute("hidden")); //$NON-NLS-1$
final String descr = getDescription(keyElement).trim();
final NodeList enumNodes = keyElement.getElementsByTagName("enum"); //$NON-NLS-1$
if (enumNodes.getLength() != 0)
{
final String[] alteratives = collectEnumEntries((Element) enumNodes.item(0));
final EnumConfigDescriptionEntry en = new EnumConfigDescriptionEntry(keyName);
en.setDescription(descr);
en.setGlobal(keyGlobal);
en.setHidden(keyHidden);
en.setOptions(alteratives);
add(en);
continue;
}
final NodeList classNodes = keyElement.getElementsByTagName("class"); //$NON-NLS-1$
if (classNodes.getLength() != 0)
{
final Element classElement = (Element) classNodes.item(0);
final String className = classElement.getAttribute("instanceof"); //$NON-NLS-1$
if (className == null)
{
throw new ParseException(messages.getString(
"ConfigDescriptionModel.ERROR_0005_MISSING_INSTANCEOF")); //$NON-NLS-1$
}
try
{
final ClassLoader classLoader = ObjectUtilities.getClassLoader(getClass());
final Class baseClass = Class.forName(className, false, classLoader);
final ClassConfigDescriptionEntry ce = new ClassConfigDescriptionEntry(keyName);
ce.setBaseClass(baseClass);
ce.setDescription(descr);
ce.setGlobal(keyGlobal);
ce.setHidden(keyHidden);
add(ce);
continue;
}
catch (Exception ex)
{
final String message = messages.getString(
"ConfigDescriptionModel.ERROR_0006_BASE_CLASS_LOAD_FAILED"); //$NON-NLS-1$
ConfigDescriptionModel.logger.error(message, ex);
continue;
}
}
final NodeList textNodes = keyElement.getElementsByTagName("text"); //$NON-NLS-1$
if (textNodes.getLength() != 0)
{
final TextConfigDescriptionEntry textEntry = new TextConfigDescriptionEntry(keyName);
textEntry.setDescription(descr);
textEntry.setGlobal(keyGlobal);
textEntry.setHidden(keyHidden);