1 package org.apache.ecs.xml; 58 59 import org.apache.ecs.*; 60 61 68 public class XML extends MultiPartElement implements Printable 69 { 70 71 75 public XML(String element_type) 76 { 77 setElementType(element_type); 78 } 79 80 86 public XML(String element_type,boolean close) 87 { 88 setElementType(element_type); 89 setNeedClosingTag(close); 90 } 91 92 97 public XML(String element_type,Filter filter) 98 { 99 setElementType(element_type); 100 setFilter(filter); 101 } 102 103 109 public XML(String element_type,boolean close,boolean filter) 110 { 111 setElementType(element_type); 112 setNeedClosingTag(close); 113 setFilterState(filter); 114 } 115 116 122 public XML(String element_type,boolean close,Filter filter) 123 { 124 setElementType(element_type); 125 setNeedClosingTag(close); 126 setFilter(filter); 127 } 128 129 136 public XML addXMLAttribute(String attribute, String attribute_value) 137 { 138 addAttribute(attribute,attribute_value); 139 return(this); 140 } 141 142 146 public XML addElement(String element) 147 { 148 addElementToRegistry(element); 149 return(this); 150 } 151 152 157 public XML addElement(String hashcode,Element element) 158 { 159 addElementToRegistry(hashcode,element); 160 return(this); 161 } 162 163 168 public XML addElement(String hashcode,String element) 169 { 170 addElementToRegistry(hashcode,element); 171 return(this); 172 } 173 174 178 public XML addElement(Element element) 179 { 180 addElementToRegistry(element); 181 return(this); 182 } 183 187 public XML removeElement(String hashcode) 188 { 189 removeElementFromRegistry(hashcode); 190 return(this); 191 } 192 193 public boolean getNeedLineBreak() { 194 boolean linebreak = true; 195 196 java.util.Enumeration enum = elements(); 197 198 201 while (enum.hasMoreElements()) { 202 Object obj = enum.nextElement(); 203 if (obj instanceof StringElement) { 204 linebreak = false; 205 break; 206 } 207 208 } 209 210 return linebreak; 211 } 212 213 public boolean getBeginEndModifierDefined() { 214 boolean answer = false; 215 216 if (! this.getNeedClosingTag()) 217 answer = true; 218 219 return answer; 220 } 221 222 public char getBeginEndModifier() { 223 return '/'; 224 } 225 } 226 | Popular Tags |