コード例 #1
0
 public void setText(String newValue) {
   if (node instanceof DefaultElement) {
     if (!hasAttribute()) {
       ((DefaultElement) node).setText(newValue);
     } else {
       ((DefaultElement) node).attribute(attribute).setValue(newValue);
     }
     dirty = true;
   }
 }
コード例 #2
0
 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()]);
 }
コード例 #3
0
 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()]);
 }
コード例 #4
0
 /** @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;
 }
コード例 #5
0
 public String[] getElementAttributeValues(String attName) {
   DefaultElement element = ((DefaultElement) node);
   Attribute at = element.attribute(attName);
   return at == null ? new String[0] : new String[] {at.getValue()};
 }