1 57 package com.sun.org.apache.html.internal.dom; 58 59 60 import org.w3c.dom.Node ; 61 import org.w3c.dom.Text ; 62 import org.w3c.dom.html.HTMLTitleElement; 63 64 65 71 public class HTMLTitleElementImpl 72 extends HTMLElementImpl 73 implements HTMLTitleElement 74 { 75 76 77 public String getText() 78 { 79 Node child; 80 String text; 81 82 child = getFirstChild(); 85 text = ""; 86 while ( child != null ) 87 { 88 if ( child instanceof Text ) 89 text = text + ( (Text ) child ).getData(); 90 child = child.getNextSibling(); 91 } 92 return text; 93 } 94 95 96 public void setText( String text ) 97 { 98 Node child; 99 Node next; 100 101 child = getFirstChild(); 104 while ( child != null ) 105 { 106 next = child.getNextSibling(); 107 removeChild( child ); 108 child = next; 109 } 110 insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() ); 111 } 112 113 114 119 public HTMLTitleElementImpl( HTMLDocumentImpl owner, String name ) 120 { 121 super( owner, name ); 122 } 123 124 125 } 126 127 | Popular Tags |