1 57 package org.enhydra.apache.html.dom; 58 59 60 import org.enhydra.apache.xerces.dom.ElementImpl; 61 import org.w3c.dom.Node ; 62 import org.w3c.dom.Text ; 63 import org.w3c.dom.html.HTMLScriptElement; 64 65 66 72 public class HTMLScriptElementImpl 73 extends HTMLElementImpl 74 implements HTMLScriptElement 75 { 76 77 78 public String getText() 79 { 80 Node child; 81 String text; 82 83 child = getFirstChild(); 86 text = ""; 87 while ( child != null ) 88 { 89 if ( child instanceof Text ) 90 text = text + ( (Text ) child ).getData(); 91 child = child.getNextSibling(); 92 } 93 return text; 94 } 95 96 97 public void setText( String text ) 98 { 99 Node child; 100 Node next; 101 102 child = getFirstChild(); 105 while ( child != null ) 106 { 107 next = child.getNextSibling(); 108 removeChild( child ); 109 child = next; 110 } 111 insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() ); 112 } 113 114 115 public String getHtmlFor() 116 { 117 return getAttribute( "for" ); 118 } 119 120 121 public void setHtmlFor( String htmlFor ) 122 { 123 setAttribute( "for", htmlFor ); 124 } 125 126 127 public String getEvent() 128 { 129 return getAttribute( "event" ); 130 } 131 132 133 public void setEvent( String event ) 134 { 135 setAttribute( "event", event ); 136 } 137 138 public String getCharset() 139 { 140 return getAttribute( "charset" ); 141 } 142 143 144 public void setCharset( String charset ) 145 { 146 setAttribute( "charset", charset ); 147 } 148 149 150 public boolean getDefer() 151 { 152 return getBinary( "defer" ); 153 } 154 155 156 public void setDefer( boolean defer ) 157 { 158 setAttribute( "defer", defer ); 159 } 160 161 162 public String getSrc() 163 { 164 return getAttribute( "src" ); 165 } 166 167 168 public void setSrc( String src ) 169 { 170 setAttribute( "src", src ); 171 } 172 173 174 public String getType() 175 { 176 return getAttribute( "type" ); 177 } 178 179 180 public void setType( String type ) 181 { 182 setAttribute( "type", type ); 183 } 184 185 186 191 public HTMLScriptElementImpl( HTMLDocumentImpl owner, String name ) 192 { 193 super( owner, name ); 194 } 195 196 197 } 198 199 | Popular Tags |