String desc = elPackage.getAttributeValue(ATTR_PACKAGE_DESCRIPTION);
if (StringUtils.isEmpty(name)) throw new LoaderException("Package name isn't specified");
if (StringUtils.isEmpty(desc)) throw new LoaderException("Package description isn't specified");
Package p = new Package(packageFile.getName(), name, desc,
elPackage.getAttributeValue(ATTR_PACKAGE_VERSION),
elPackage.getAttributeValue(ATTR_PACKAGE_AUTHOR),
elPackage.getAttributeValue(ATTR_PACKAGE_EMAIL));
List elements = elPackage.getChildren();
for (Object elementO : elements)
{
Element element = (Element)elementO;
String elName = element.getName();
IPlugin plugin = null;
if (NODE_THEME.equals(elName))
{
plugin = parseTheme(element, loader);
} else if (NODE_ACTIONS.equals(elName))
{
plugin = parseActions(element, loader);
} else if (NODE_RESOURCES.equals(elName))
{
plugin = parseResources(element, loader);
} else if (NODE_STRINGS.equals(elName))
{
plugin = parseStrings(element, loader);
} else if (NODE_PREFERENCES.equals(elName))
{
plugin = parsePreferences(element);
} else if (NODE_SMARTFEED.equals(elName))
{
plugin = parseSmartFeed(element, loader);
} else if (NODE_CODE.equals(elName))
{
plugin = parseCode(element, loader);
} else if (NODE_TOOLBAR.equals(elName))
{
plugin = parseToolbar(element);
}
if (plugin != null) p.add(plugin);
}
return p;
}