1 20 21 package org.ozoneDB.xml.dom.html; 22 23 import org.ozoneDB.xml.dom.ElementImpl; 24 import org.w3c.dom.Node ; 25 import org.w3c.dom.Text ; 26 import org.w3c.dom.html.HTMLTitleElement; 27 28 29 35 public final class HTMLTitleElementImpl extends HTMLElementImpl implements HTMLTitleElement { 36 37 38 public String getText() { 39 Node child; 40 String text; 41 42 child = getFirstChild(); 45 text = ""; 46 while (child != null) { 47 if (child instanceof Text ) { 48 text = text + ((Text )child).getData(); 49 } 50 child = child.getNextSibling(); 51 } 52 return text; 53 } 54 55 56 public void setText( String text ) { 57 Node child; 58 Node next; 59 60 child = getFirstChild(); 63 while (child != null) { 64 next = child.getNextSibling(); 65 removeChild( child ); 66 child = next; 67 } 68 insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() ); 69 } 70 71 72 77 public HTMLTitleElementImpl( HTMLDocumentImpl owner, String name ) { 78 super( owner, "TITLE" ); 79 } 80 81 } 82 | Popular Tags |