1 23 24 package org.enhydra.xml.xmlc.html; 25 26 import org.enhydra.xml.io.DOMFormatter; 27 import org.enhydra.xml.xmlc.XMLObjectImpl; 28 import org.w3c.dom.Element ; 29 import org.w3c.dom.Node ; 30 import org.w3c.dom.NodeList ; 31 import org.w3c.dom.html.HTMLCollection; 32 import org.w3c.dom.html.HTMLDocument; 33 import org.w3c.dom.html.HTMLElement; 34 35 39 42 public abstract class HTMLObjectImpl extends XMLObjectImpl 43 implements HTMLObject { 44 48 private static DOMFormatter fFormatter = null; 49 50 54 protected HTMLObjectImpl() { 55 } 56 57 64 abstract public Node cloneNode(boolean deep); 65 66 69 public String toDocument() { 70 if (fFormatter == null) { 72 fFormatter = new DOMFormatter(DOMFormatter.getDefaultOutputOptions(getDocument())); 73 } 74 return fFormatter.toString(this); 75 } 76 77 80 public String getTitle() { 81 return ((HTMLDocument)getDocument()).getTitle(); 82 } 83 84 87 public void setTitle(String title) { 88 ((HTMLDocument)getDocument()).setTitle(title); 89 } 90 91 94 public String getReferrer() { 95 return ((HTMLDocument)getDocument()).getReferrer(); 96 } 97 98 101 public String getDomain() { 102 return ((HTMLDocument)getDocument()).getDomain(); 103 } 104 105 108 public String getURL() { 109 return ((HTMLDocument)getDocument()).getURL(); 110 } 111 112 115 public HTMLElement getBody() { 116 return ((HTMLDocument)getDocument()).getBody(); 117 } 118 119 122 public void setBody(HTMLElement body) { 123 ((HTMLDocument)getDocument()).setBody(body); 124 } 125 126 129 public HTMLCollection getImages() { 130 return ((HTMLDocument)getDocument()).getImages(); 131 } 132 133 136 public HTMLCollection getApplets() { 137 return ((HTMLDocument)getDocument()).getApplets(); 138 } 139 140 143 public HTMLCollection getLinks() { 144 return ((HTMLDocument)getDocument()).getLinks(); 145 } 146 147 150 public HTMLCollection getForms() { 151 return ((HTMLDocument)getDocument()).getForms(); 152 } 153 154 157 public HTMLCollection getAnchors() { 158 return ((HTMLDocument)getDocument()).getAnchors(); 159 } 160 161 164 public String getCookie() { 165 return ((HTMLDocument)getDocument()).getCookie(); 166 } 167 168 171 public void setCookie(String cookie) { 172 ((HTMLDocument)getDocument()).setCookie(cookie); 173 } 174 175 178 public void open() { 179 ((HTMLDocument)getDocument()).open(); 180 } 181 182 185 public void close() { 186 ((HTMLDocument)getDocument()).close(); 187 } 188 189 192 public void write(String text) { 193 ((HTMLDocument)getDocument()).write(text); 194 } 195 196 199 public void writeln(String text) { 200 ((HTMLDocument)getDocument()).writeln(text); 201 } 202 203 206 public Element getElementById(String elementId) { 207 return ((HTMLDocument)getDocument()).getElementById(elementId); 208 } 209 210 213 public NodeList getElementsByName(String elementName) { 214 return ((HTMLDocument)getDocument()).getElementsByName(elementName); 215 } 216 } 217 | Popular Tags |