use of org.jdom2.Namespace in project JMRI by JMRI.
the class LocaleSelectorTest method testFindPartialCodeNoAttribute.
public void testFindPartialCodeNoAttribute() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").addContent(new Element("temp").setAttribute("lang", "aa_BB", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl", xml).addContent("c")).addContent(new Element("temp").setAttribute("lang", "kl_AA", xml).addContent("d"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "c", result);
}
use of org.jdom2.Namespace in project JMRI by JMRI.
the class LocaleSelectorTest method testFindFullCodeNoAttribute.
public void testFindFullCodeNoAttribute() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").addContent(new Element("temp").setAttribute("lang", "aa_BB", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl_KL", xml).addContent("c"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "c", result);
}
use of org.jdom2.Namespace in project JMRI by JMRI.
the class LocaleSelectorTest method testFindDefault.
public void testFindDefault() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").setAttribute("temp", "a").addContent(new Element("temp").setAttribute("lang", "hh", xml).addContent("b"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "a", result);
}
use of org.jdom2.Namespace in project JMRI by JMRI.
the class RevHistoryXml method loadRevHistory.
public static RevHistory loadRevHistory(Element e) {
RevHistory r = new RevHistory();
java.util.List<Element> list = e.getChildren("revision", Namespace.getNamespace(NAMESPACE));
for (int i = 0; i < list.size(); i++) {
loadRevision(r, list.get(i));
}
return r;
}
use of org.jdom2.Namespace in project JMRI by JMRI.
the class RevHistoryXml method historyElement.
static Element historyElement(RevHistory r) {
ArrayList<Revision> list = r.getList();
Element e = new Element("revhistory", NAMESPACE);
for (int i = 0; i < list.size(); i++) {
Element revision = revisionElement(list.get(i));
e.addContent(revision);
}
return e;
}
Aggregations