示例#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);
   }
 }