1 7 8 package javax.swing.text.html.parser; 9 10 import java.util.Vector ; 11 import java.util.Hashtable ; 12 import java.util.Enumeration ; 13 import java.io.*; 14 15 30 public final 31 class AttributeList implements DTDConstants , Serializable { 32 public String name; 33 public int type; 34 public Vector <?> values; 35 public int modifier; 36 public String value; 37 public AttributeList next; 38 39 AttributeList() { 40 } 41 42 45 public AttributeList(String name) { 46 this.name = name; 47 } 48 49 52 public AttributeList(String name, int type, int modifier, String value, Vector <?> values, AttributeList next) { 53 this.name = name; 54 this.type = type; 55 this.modifier = modifier; 56 this.value = value; 57 this.values = values; 58 this.next = next; 59 } 60 61 64 public String getName() { 65 return name; 66 } 67 68 72 public int getType() { 73 return type; 74 } 75 76 80 public int getModifier() { 81 return modifier; 82 } 83 84 87 public Enumeration <?> getValues() { 88 return (values != null) ? values.elements() : null; 89 } 90 91 94 public String getValue() { 95 return value; 96 } 97 98 101 public AttributeList getNext() { 102 return next; 103 } 104 105 108 public String toString() { 109 return name; 110 } 111 112 115 static Hashtable attributeTypes = new Hashtable (); 116 117 static void defineAttributeType(String nm, int val) { 118 Integer num = new Integer (val); 119 attributeTypes.put(nm, num); 120 attributeTypes.put(num, nm); 121 } 122 123 static { 124 defineAttributeType("CDATA", CDATA); 125 defineAttributeType("ENTITY", ENTITY); 126 defineAttributeType("ENTITIES", ENTITIES); 127 defineAttributeType("ID", ID); 128 defineAttributeType("IDREF", IDREF); 129 defineAttributeType("IDREFS", IDREFS); 130 defineAttributeType("NAME", NAME); 131 defineAttributeType("NAMES", NAMES); 132 defineAttributeType("NMTOKEN", NMTOKEN); 133 defineAttributeType("NMTOKENS", NMTOKENS); 134 defineAttributeType("NOTATION", NOTATION); 135 defineAttributeType("NUMBER", NUMBER); 136 defineAttributeType("NUMBERS", NUMBERS); 137 defineAttributeType("NUTOKEN", NUTOKEN); 138 defineAttributeType("NUTOKENS", NUTOKENS); 139 140 attributeTypes.put("fixed", new Integer (FIXED)); 141 attributeTypes.put("required", new Integer (REQUIRED)); 142 attributeTypes.put("current", new Integer (CURRENT)); 143 attributeTypes.put("conref", new Integer (CONREF)); 144 attributeTypes.put("implied", new Integer (IMPLIED)); 145 } 146 147 public static int name2type(String nm) { 148 Integer i = (Integer )attributeTypes.get(nm); 149 return (i == null) ? CDATA : i.intValue(); 150 } 151 152 public static String type2name(int tp) { 153 return (String )attributeTypes.get(new Integer (tp)); 154 } 155 } 156 | Popular Tags |