public void setText(String newValue) {
   if (node instanceof DefaultElement) {
     if (!hasAttribute()) {
       ((DefaultElement) node).setText(newValue);
     } else {
       ((DefaultElement) node).attribute(attribute).setValue(newValue);
     }
     dirty = true;
   }
 }
 public String[] getElementAttributeNames() {
   DefaultElement element = ((DefaultElement) node);
   List l = element.attributes();
   DefaultAttribute child;
   ArrayList<String> names = new ArrayList<String>();
   for (Iterator i = l.iterator(); i.hasNext(); ) {
     child = (DefaultAttribute) i.next();
     if (!names.contains(child.getName())) names.add(child.getName());
   }
   return names.toArray(new String[names.size()]);
 }
 public String[] getElementChildrenNames() {
   DefaultElement element = ((DefaultElement) node);
   List<DefaultElement> l = element.elements();
   DefaultElement child;
   ArrayList<String> names = new ArrayList<String>();
   for (Iterator<DefaultElement> i = l.iterator(); i.hasNext(); ) {
     child = i.next();
     if (!names.contains(child.getName())) names.add(child.getName());
   }
   return names.toArray(new String[names.size()]);
 }
 /** @return xml-element containing current lookup data */
 public Element exportToXML() {
   DefaultElement country = new DefaultElement("CountryLookup");
   Set<String> codeKeys = countryLookup.keySet();
   for (String code : codeKeys) {
     DefaultElement countryXml = new DefaultElement("CountryKey");
     countryXml.addAttribute("code", code);
     countryXml.addAttribute("countryGeoIP", getGeoIpCountryName(code));
     countryXml.addAttribute("countryPingEr", getPingErCountryName(code));
     countryXml.addAttribute("regionPingEr", getPingErRegionName(code));
     country.add(countryXml);
   }
   return country;
 }
 public String[] getElementAttributeValues(String attName) {
   DefaultElement element = ((DefaultElement) node);
   Attribute at = element.attribute(attName);
   return at == null ? new String[0] : new String[] {at.getValue()};
 }