1 16 package org.apache.html.dom; 17 18 import org.w3c.dom.Node ; 19 import org.w3c.dom.Text ; 20 import org.w3c.dom.html.HTMLScriptElement; 21 22 29 public class HTMLScriptElementImpl 30 extends HTMLElementImpl 31 implements HTMLScriptElement 32 { 33 34 private static final long serialVersionUID = 3832626162072498224L; 35 36 public String getText() 37 { 38 Node child; 39 StringBuffer text = new StringBuffer (); 40 41 child = getFirstChild(); 44 while ( child != null ) 45 { 46 if ( child instanceof Text ) { 47 text.append(( (Text ) child ).getData()); 48 } 49 child = child.getNextSibling(); 50 } 51 return text.toString(); 52 } 53 54 55 public void setText( String text ) 56 { 57 Node child; 58 Node next; 59 60 child = getFirstChild(); 63 while ( child != null ) 64 { 65 next = child.getNextSibling(); 66 removeChild( child ); 67 child = next; 68 } 69 insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() ); 70 } 71 72 73 public String getHtmlFor() 74 { 75 return getAttribute( "for" ); 76 } 77 78 79 public void setHtmlFor( String htmlFor ) 80 { 81 setAttribute( "for", htmlFor ); 82 } 83 84 85 public String getEvent() 86 { 87 return getAttribute( "event" ); 88 } 89 90 91 public void setEvent( String event ) 92 { 93 setAttribute( "event", event ); 94 } 95 96 public String getCharset() 97 { 98 return getAttribute( "charset" ); 99 } 100 101 102 public void setCharset( String charset ) 103 { 104 setAttribute( "charset", charset ); 105 } 106 107 108 public boolean getDefer() 109 { 110 return getBinary( "defer" ); 111 } 112 113 114 public void setDefer( boolean defer ) 115 { 116 setAttribute( "defer", defer ); 117 } 118 119 120 public String getSrc() 121 { 122 return getAttribute( "src" ); 123 } 124 125 126 public void setSrc( String src ) 127 { 128 setAttribute( "src", src ); 129 } 130 131 132 public String getType() 133 { 134 return getAttribute( "type" ); 135 } 136 137 138 public void setType( String type ) 139 { 140 setAttribute( "type", type ); 141 } 142 143 144 149 public HTMLScriptElementImpl( HTMLDocumentImpl owner, String name ) 150 { 151 super( owner, name ); 152 } 153 154 155 } 156 157 | Popular Tags |