All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.enhydra.xml.xhtml.dom.xerces.XHTMLTitleElementImpl Maven / Gradle / Ivy

The newest version!
/*
 * Enhydra Java Application Server Project
 * 
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License on
 * the Enhydra web site ( http://www.enhydra.org/ ).
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
 * the License for the specific terms governing rights and limitations
 * under the License.
 * 
 * The Initial Developer of the Original Code is DigitalSesame
 * Portions created by DigitalSesame are Copyright (C) 1997-2000 DigitalSesame
 * All Rights Reserved.
 * 
 * Contributor(s):
 *     Rex Tsai 
 *     David Li 
 * 
 * $Id: XHTMLTitleElementImpl.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
 */

package org.enhydra.xml.xhtml.dom.xerces;

import org.w3c.dom.Node;
import org.w3c.dom.Text;

public class XHTMLTitleElementImpl 
    extends XHTMLElementImpl 
    implements org.enhydra.xml.xhtml.dom.XHTMLTitleElement 
{

    public XHTMLTitleElementImpl (XHTMLDocumentBase owner, String namespaceURI, String tagName) {
	super( owner, namespaceURI, tagName);
    }

        public void setId (String newValue) {
	setAttribute("id", newValue);
    }

    public String getId () {
	return getAttribute ("id");
    }
    public void setLang (String newValue) {
	setAttribute("lang", newValue);
    }

    public String getLang () {
	return getAttribute ("lang");
    }
    public void setDir (String newValue) {
	setAttribute("dir", newValue);
    }

    public String getDir () {
	return getAttribute ("dir");
    }
    public void setClassName (String newValue) {
	setAttribute("class", newValue);
    }

    public String getClassName () {
	return getAttribute ("class");
    }
    public void setTitle (String newValue) {
	setAttribute("title", newValue);
    }

    public String getTitle () {
	return getAttribute ("title");
    }
    public void setXmlLang (String newValue) {
	setAttribute("xml:lang", newValue);
    }

    public String getXmlLang () {
	return getAttribute ("xml:lang");
    }
;

        public String getText() {
        Node      child;
        String    text;
        
        // Find the Text nodes contained within this element and return their
        // concatenated value. Required to go around comments, entities, etc.
        child = getFirstChild();
        text = "";
        while ( child != null ) {
            if ( child instanceof Text )
                text = text + ( (Text) child ).getData();
            child = child.getNextSibling();
        }
        return text;
    }
    
    public void setText( String text ) {
        Node    child;
        Node    next;
        
        // Delete all the nodes and replace them with a single Text node.
        // This is the only approach that can handle comments and other nodes.
        child = getFirstChild();
        while ( child != null ) {
            next = child.getNextSibling();
            removeChild( child );
            child = next;
        }
        insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() );
    }


;
}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy