1 58 package org.apache.ecs.html; 59 60 import org.apache.ecs.*; 61 62 import java.io.OutputStream ; 63 import java.io.PrintWriter ; 64 import java.io.IOException ; 65 import java.io.ByteArrayOutputStream ; 66 import java.io.BufferedOutputStream ; 67 import java.util.Enumeration ; 68 import java.util.Vector ; 69 import org.apache.ecs.storage.Hash; 70 71 77 public class Comment extends MultiPartElement implements Printable 78 { 79 80 83 { 84 setElementType("--"); 85 setBeginStartModifier('!'); 86 } 87 88 91 public Comment() 92 { 93 } 94 95 98 public Comment(String element) 99 { 100 addElement(element); 101 } 102 103 106 public Comment(Element element) 107 { 108 addElement(element); 109 } 110 111 116 public Comment addElement(String hashcode,Element element) 117 { 118 addElementToRegistry(hashcode,element); 119 return(this); 120 } 121 122 127 public Comment addElement(String hashcode,String element) 128 { 129 addElementToRegistry(hashcode,element); 130 return(this); 131 } 132 133 137 public Comment addElement(Element element) 138 { 139 addElementToRegistry(element); 140 return(this); 141 } 142 146 public Comment addElement(String element) 147 { 148 addElementToRegistry(element); 149 return(this); 150 } 151 155 public Comment removeElement(String hashcode) 156 { 157 removeElementFromRegistry(hashcode); 158 return(this); 159 } 160 161 public String createStartTag() 162 { 163 setEndTagChar(' '); 164 StringBuffer out = new StringBuffer (); 165 out.append(getStartTagChar()); 166 167 if(getBeginStartModifierDefined()) 168 { 169 out.append(getBeginStartModifier()); 170 } 171 out.append(getElementType()); 172 173 if(getBeginEndModifierDefined()) 174 { 175 out.append(getBeginEndModifier()); 176 } 177 out.append(getEndTagChar()); 178 179 setEndTagChar('>'); return(out.toString()); 181 } 182 183 public String createEndTag() 184 { 185 StringBuffer out = new StringBuffer (); 186 setStartTagChar(' '); 187 setEndStartModifier(' '); 188 189 out.append(getStartTagChar()); 190 191 if(getEndStartModifierDefined()) 192 { 193 out.append(getEndStartModifier()); 194 } 195 out.append(getElementType()); 196 197 if(getEndEndModifierDefined()) 198 { 199 out.append(getEndEndModifier()); 200 } 201 out.append(getEndTagChar()); 202 setStartTagChar('<'); 204 return(out.toString()); 205 } 206 } 207 | Popular Tags |