}
}
public void testLanguageMapping() {
XMLElement xmlElement = new XMLElementBuilder("message", "jabber:test").
addText("t1").
startInnerElement("body").
endInnerElement().
startInnerElement("body").
addAttribute(NamespaceURIs.XML, "lang", "en").
endInnerElement().
startInnerElement("body").
addAttribute(NamespaceURIs.XML, "lang", "de").
endInnerElement().
addText("body").
addText("t3").
startInnerElement("single").
addAttribute(NamespaceURIs.XML, "lang", "ru").
endInnerElement().
startInnerElement("body_inconsistent").
addAttribute(NamespaceURIs.XML, "lang", "ru").
endInnerElement().
startInnerElement("body_inconsistent").
addAttribute(NamespaceURIs.XML, "lang", "ru").
endInnerElement().
startInnerElement("body_lang_null").
addAttribute("order", "1").
endInnerElement().
startInnerElement("body_lang_null").
addAttribute("order", "2").
endInnerElement().
addText("t4").
build();
try {
Map<String,XMLElement> map = xmlElement.getInnerElementsByXMLLangNamed("body");
assertEquals(3, map.size());
XMLElement element = map.get("en");
assertEquals("en", element.getXMLLang());
element = map.get("de");
assertEquals("de", element.getXMLLang());
element = map.get(null);
assertEquals(null, element.getXMLLang());
} catch (XMLSemanticError xmlSemanticError) {
fail("no error expected");
}