Пример #1
0
 /** Convert the attributes in the given XML Element into a Map of name/value pairs. */
 protected static Map createAttributeMap(Element el) {
   Log.debug("Creating attribute map for " + el);
   Map attributes = new HashMap();
   Iterator iter = el.getAttributes().iterator();
   while (iter.hasNext()) {
     Attribute att = (Attribute) iter.next();
     attributes.put(att.getName(), att.getValue());
   }
   return attributes;
 }
Пример #2
0
 public Step(Resolver resolver, Map attributes) {
   this(resolver, "");
   Log.debug("Instantiating " + getClass());
   if (Log.expectDebugOutput) {
     Iterator iter = attributes.keySet().iterator();
     while (iter.hasNext()) {
       String key = (String) iter.next();
       Log.debug(key + "=" + attributes.get(key));
     }
   }
   parseStepAttributes(attributes);
 }
Пример #3
0
 /** Add an attribute to the given XML Element. Attributes are kept in alphabetical order. */
 protected Element addAttributes(Element el) {
   // Use a TreeMap to keep the attributes sorted on output
   Map atts = new TreeMap(getAttributes());
   Iterator iter = atts.keySet().iterator();
   while (iter.hasNext()) {
     String key = (String) iter.next();
     String value = (String) atts.get(key);
     if (value == null) {
       Log.warn("Attribute '" + key + "' value was null in step " + getXMLTag());
       value = "";
     }
     el.setAttribute(key, value);
   }
   return el;
 }