Пример #1
0
 public static void main(String args[]) throws Exception {
   XMLElement elt = new XMLElement("FOO");
   elt.setAttribute(null, "good");
   XMLWriter writer = new XMLWriter(System.out);
   writer.write(elt);
 }
Пример #2
0
 /** Adds an attribute to current element of the DOM Document. */
 public void addAttribute(String name, double value) {
   // Remove the awkard .0 at the end of each number
   String str = Double.toString(value);
   if (str.endsWith(".0")) str = str.substring(0, str.length() - 2);
   current.setAttribute(name, str);
 }
Пример #3
0
 /** Adds an attribute to current element of the DOM Document. */
 public void addAttribute(String name, int value) {
   current.setAttribute(name, Integer.toString(value));
 }
Пример #4
0
 /** Adds an attribute to current element of the DOM Document. */
 public void addAttribute(String name, boolean value) {
   current.setAttribute(name, new Boolean(value).toString());
 }
Пример #5
0
 /** Adds an attribute to current element of the DOM Document. */
 public void addAttribute(String name, String value) {
   if (value != null) {
     current.setAttribute(name, value);
   }
 }