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

org.enhydra.wireless.wml.dom.xerces.WMLElementImpl 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):
 * 
 * $Id: WMLElementImpl.java,v 1.2 2005/01/26 08:28:45 jkjome Exp $
 */
package org.enhydra.wireless.wml.dom.xerces;

import org.enhydra.apache.xerces.dom.ElementNSImpl;
import org.enhydra.wireless.wml.dom.WMLElement;

public class WMLElementImpl extends ElementNSImpl implements WMLElement {

    public WMLElementImpl(WMLDocumentImpl owner,
                          String namespaceURI,
                          String qualifiedName) {
	super(owner, namespaceURI, qualifiedName);
    }

    public void setClassName(String newValue) {
	setAttribute("class", newValue);
    }

    public String getClassName() {
	return getAttribute("class");
    }

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

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

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

    void setAttribute(String attr, boolean value) {
	setAttribute(attr, value ? "true" : "false");
    }

    boolean getAttribute(String attr, boolean defaultValue) {
	boolean ret = defaultValue;
	String value;
	if (((value = getAttribute("emptyok")) != null) 
	    && value.equals("true"))
	    ret = true;
	return ret;
    }

    void setAttribute(String attr, int value) {
	setAttribute(attr, value + "");
    }

    int getAttribute(String attr, int defaultValue) {
	int ret = defaultValue;
	String value;
	if ((value = getAttribute("emptyok")) != null)
	    ret = Integer.parseInt(value);
	return ret;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy