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

org.enhydra.wireless.voicexml.dom.xerces.VoiceXMLElementImpl 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: VoiceXMLElementImpl.java,v 1.2 2005/01/26 08:28:45 jkjome Exp $
 */

package org.enhydra.wireless.voicexml.dom.xerces;

import org.enhydra.apache.xerces.dom.ElementNSImpl;
import org.enhydra.wireless.voicexml.dom.VoiceXMLElement;

public class VoiceXMLElementImpl extends ElementNSImpl implements VoiceXMLElement {

    public VoiceXMLElementImpl(VoiceXMLDocumentImpl owner,
                               String namespaceURI,
                               String qualifiedName) {
	super(owner, namespaceURI, qualifiedName);
    }

    /*
     * Get the value of a boolean attribute.
     */
    protected final boolean getBooleanAttribute(String attr,
                                                boolean defaultValue) {
	String attrVal = getAttribute(attr);
        if (attrVal != null) {
            return attrVal.equals("true");
        } else {
            return defaultValue;
        }
    }

    /*
     * Get the value of a boolean attribute.
     */
    protected final boolean getBooleanAttribute(String attr) {
        return getBooleanAttribute(attr, false);
    }

    /*
     * Set the value of a boolean attribute.
     */
    protected final void setAttribute(String attr,
                                      boolean value) {
        setAttribute(attr, (value ? "true" : "false"));
    }

    /*
     * Get the value of a integer attribute
     */
    protected final int getIntAttribute(String attr,
                                        int defaultValue) {
	String attrVal = getAttribute(attr);
	if (attrVal != null) {
            return Integer.parseInt(attrVal);
	} else {
            return defaultValue;
        }
    }

    /*
     * Get the value of a integer attribute
     */
    protected final int getIntAttribute(String attr) {
        return getIntAttribute(attr, 0);
    }

    /*
     * Set the value of a integer attribute.
     */
    protected final void setAttribute(String attr,
                                      int value) {
        setAttribute(attr, Integer.toString(value));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy