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.HTMLTitleElement; 64 65 66 72 public class HTMLTitleElementImpl 73 extends HTMLElementImpl 74 implements HTMLTitleElement 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 120 public HTMLTitleElementImpl( HTMLDocumentImpl owner, String name ) 121 { 122 super( owner, name ); 123 } 124 125 126 } 127 128 | Popular Tags |