DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse(is);
NodeList nodes = document.getElementsByTagName("locale-config");
for (int i = 0; i < nodes.getLength(); i++)
{
Node node = nodes.item(i);
NodeList children = node.getChildNodes();
LocaleConfig config = new LocaleConfigImpl();
for (int j = 0; j < children.getLength(); j++)
{
Node element = children.item(j);
if ("locale".equals(element.getNodeName()))
{
config.setLocale(element.getFirstChild().getNodeValue());
}
else if ("output-encoding".equals(element.getNodeName()))
{
config.setOutputEncoding(element.getFirstChild().getNodeValue());
}
else if ("input-encoding".equals(element.getNodeName()))
{
config.setInputEncoding(element.getFirstChild().getNodeValue());
}
else if ("description".equals(element.getNodeName()))
{
config.setDescription(element.getFirstChild().getNodeValue());
}
else if ("orientation".equals(element.getNodeName()))
{
String s = element.getFirstChild().getNodeValue();
Orientation orientation = orientations.get(s);
if (orientation == null)
{
log.error("Wrong orientation value " + s);
}