1 26 27 package org.objectweb.jonas.security.realm.lib; 28 29 import java.util.Enumeration ; 30 import java.util.Hashtable ; 31 import java.util.Vector ; 32 33 37 public class XML { 38 39 42 private XML() { 43 44 } 45 46 53 public static void appendVectorToBuffer(String name, StringBuffer buffer, Vector vector) { 54 if (vector.size() > 0) { 55 buffer.append(" " + name + "\""); 56 int nb = 0; 57 for (Enumeration e = vector.elements(); e.hasMoreElements();) { 58 if (nb > 0) { 59 buffer.append(","); 60 } 61 String s = (String ) e.nextElement(); 62 buffer.append(s); 63 nb++; 64 } 65 buffer.append("\""); 66 } 67 } 68 69 74 public static void xmlVector(StringBuffer buffer, Vector vector) { 75 if (vector.size() > 0) { 76 for (Enumeration e = vector.elements(); e.hasMoreElements();) { 77 Object o = e.nextElement(); 78 buffer.append(o.toString()); 79 buffer.append("\n"); 80 } 81 } 82 } 83 84 89 public static void xmlHashtable(StringBuffer buffer, Hashtable hashtable) { 90 xmlHashtable(buffer, hashtable, ""); 91 } 92 93 99 public static void xmlHashtable(StringBuffer buffer, Hashtable hashtable, String indent) { 100 if (hashtable.size() > 0) { 101 for (Enumeration e = hashtable.elements(); e.hasMoreElements();) { 102 Object o = e.nextElement(); 103 buffer.append(indent + o.toString()); 104 buffer.append("\n"); 105 } 106 } 107 } 108 109 } | Popular Tags |