1 7 8 package org.dom4j.dtd; 9 10 18 public class AttributeDecl { 19 20 private String elementName; 21 22 23 private String attributeName; 24 25 26 private String type; 27 28 29 private String value; 30 31 32 private String valueDefault; 33 34 public AttributeDecl() { 35 } 36 37 public AttributeDecl(String elementName, String attributeName, String type, 38 String valueDefault, String value) { 39 this.elementName = elementName; 40 this.attributeName = attributeName; 41 this.type = type; 42 this.value = value; 43 this.valueDefault = valueDefault; 44 } 45 46 51 public String getElementName() { 52 return elementName; 53 } 54 55 61 public void setElementName(String elementName) { 62 this.elementName = elementName; 63 } 64 65 70 public String getAttributeName() { 71 return attributeName; 72 } 73 74 80 public void setAttributeName(String attributeName) { 81 this.attributeName = attributeName; 82 } 83 84 89 public String getType() { 90 return type; 91 } 92 93 99 public void setType(String type) { 100 this.type = type; 101 } 102 103 108 public String getValue() { 109 return value; 110 } 111 112 118 public void setValue(String value) { 119 this.value = value; 120 } 121 122 127 public String getValueDefault() { 128 return valueDefault; 129 } 130 131 137 public void setValueDefault(String valueDefault) { 138 this.valueDefault = valueDefault; 139 } 140 141 public String toString() { 142 StringBuffer buffer = new StringBuffer ("<!ATTLIST "); 143 buffer.append(elementName); 144 buffer.append(" "); 145 buffer.append(attributeName); 146 buffer.append(" "); 147 buffer.append(type); 148 buffer.append(" "); 149 150 if (valueDefault != null) { 151 buffer.append(valueDefault); 152 153 if (valueDefault.equals("#FIXED")) { 154 buffer.append(" \""); 155 buffer.append(value); 156 buffer.append("\""); 157 } 158 } else { 159 buffer.append("\""); 160 buffer.append(value); 161 buffer.append("\""); 162 } 163 164 buffer.append(">"); 165 166 return buffer.toString(); 167 } 168 } 169 170 206 | Popular Tags |