1 package org.apache.ecs; 2 3 60 61 import org.apache.ecs.*; 62 63 92 public class Doctype extends SinglePartElement implements Printable 93 { 94 public static final String elementName = "!DOCTYPE"; 95 public static final String PUBLIC = "PUBLIC"; 96 97 protected String name; 98 protected String visibility; 99 protected String identifier; 100 protected String uri; 101 102 { 103 setElementType(elementName); 104 setCase(Element.UPPERCASE); 105 } 106 107 111 public Doctype() 112 { 113 updateElementType(); 114 } 115 116 117 124 public Doctype( String name, String id, String uri ) 125 { 126 this.name = name; 127 this.visibility = PUBLIC; 128 this.identifier = id; 129 this.uri = uri; 130 updateElementType(); 131 } 132 133 140 public Doctype( String name, String visibility, String id, String uri ) 141 { 142 this.name = name; 143 this.visibility = visibility; 144 this.identifier = id; 145 this.uri = uri; 146 updateElementType(); 147 } 148 149 153 protected void updateElementType() 154 { 155 setElementType( elementName 156 + " " + name 157 + " " + visibility 158 + " " + identifier 159 + " " + uri ); 160 } 161 162 168 public Doctype setName( String name ) 169 { 170 this.name = name; 171 updateElementType(); 172 return( this ); 173 } 174 180 public Doctype setVisibility( String visibility ) 181 { 182 this.visibility = visibility; 183 updateElementType(); 184 return( this ); 185 } 186 187 193 public Doctype setIdentifier( String identifier ) 194 { 195 this.identifier = identifier; 196 updateElementType(); 197 return( this ); 198 } 199 200 206 public Doctype setUri( String uri ) 207 { 208 this.uri = uri; 209 updateElementType(); 210 return(this); 211 } 212 213 220 public Doctype addElement( String hashcode, Element element ) 221 { 222 addElementToRegistry( hashcode, element ); 223 return(this); 224 } 225 226 233 public Doctype addElement( String hashcode, String element ) 234 { 235 addElementToRegistry(hashcode,element); 236 return(this); 237 } 238 239 245 public Doctype addElement(Element element) 246 { 247 addElementToRegistry(element); 248 return(this); 249 } 250 251 257 public Doctype addElement(String element) 258 { 259 addElementToRegistry(element); 260 return(this); 261 } 262 263 269 public Doctype removeElement(String hashcode) 270 { 271 removeElementFromRegistry(hashcode); 272 return(this); 273 } 274 275 283 public static class Html40Strict extends Doctype { 284 285 public Html40Strict() { 286 this.name = "HTML"; 287 this.visibility = PUBLIC; 288 this.identifier = "\"-//W3C//DTD HTML 4.0//EN\""; 289 this.uri = "\"http://www.w3.org/TR/REC-html40/strict.dtd\""; 290 this.updateElementType(); 291 } 292 } 293 294 302 public static class Html40Transitional extends Doctype { 303 304 public Html40Transitional() { 305 this.name = "HTML"; 306 this.visibility = PUBLIC; 307 this.identifier = "\"-//W3C//DTD HTML 4.0 Transitional//EN\""; 308 this.uri = "\"http://www.w3.org/TR/REC-html40/loose.dtd\""; 309 this.updateElementType(); 310 } 311 } 312 313 320 public static class Html40Frameset extends Doctype { 321 322 public Html40Frameset() { 323 this.name = "HTML"; 324 this.visibility = PUBLIC; 325 this.identifier = "\"-//W3C//DTD HTML 4.0 Frameset//EN\""; 326 this.uri = "\"http://www.w3.org/TR/REC-html40/frameset.dtd\""; 327 this.updateElementType(); 328 } 329 } 330 331 339 public static class Html401Strict extends Doctype { 340 341 public Html401Strict() { 342 this.name = "HTML"; 343 this.visibility = PUBLIC; 344 this.identifier = "\"-//W3C//DTD HTML 4.01//EN\""; 345 this.uri = "\"http://www.w3.org/TR/html4/strict.dtd\""; 346 this.updateElementType(); 347 } 348 } 349 350 358 public static class Html401Transitional extends Doctype { 359 360 public Html401Transitional() { 361 this.name = "HTML"; 362 this.visibility = PUBLIC; 363 this.identifier = "\"-//W3C//DTD HTML 4.01 Transitional//EN\""; 364 this.uri = "\"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\""; 365 this.updateElementType(); 366 } 367 } 368 369 376 public static class Html401Frameset extends Doctype { 377 378 public Html401Frameset() { 379 this.name = "HTML"; 380 this.visibility = PUBLIC; 381 this.identifier = "\"-//W3C//DTD HTML 4.01 Frameset//EN\""; 382 this.uri = "\"http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd\""; 383 this.updateElementType(); 384 } 385 } 386 387 395 public static class XHtml10Strict extends Doctype { 396 397 public XHtml10Strict() { 398 this.name = "html"; 399 this.visibility = PUBLIC; 400 this.identifier = "\"-//W3C//DTD XHTML 1.0 Strict//EN\""; 401 this.uri = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\""; 402 this.updateElementType(); 403 } 404 } 405 406 414 public static class XHtml10Transitional extends Doctype { 415 416 public XHtml10Transitional() { 417 this.name = "html"; 418 this.visibility = PUBLIC; 419 this.identifier = "\"-//W3C//DTD XHTML 1.0 Transitional//EN\""; 420 this.uri = 421 "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\""; 422 this.updateElementType(); 423 } 424 } 425 426 434 public static class XHtml10Frameset extends Doctype { 435 436 public XHtml10Frameset() { 437 this.name = "html"; 438 this.visibility = PUBLIC; 439 this.identifier = "\"-//W3C//DTD XHTML 1.0 Frameset//EN\""; 440 this.uri = 441 "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\""; 442 this.updateElementType(); 443 } 444 } 445 } 446 | Popular Tags |