org.jvoicexml.xml.ssml.Mark Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.jvoicexml.xml Show documentation
Show all versions of org.jvoicexml.xml Show documentation
The Open Source Voice Browser
The newest version!
/*
* File: $HeadURL$
* Version: $LastChangedRevision$
* Date: $Date$
* Author: $LastChangedBy$
*
* JVoiceXML - A free VoiceXML implementation.
*
* Copyright (C) 2005-2013 JVoiceXML group - http://jvoicexml.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Library General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
* details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.jvoicexml.xml.ssml;
import java.util.ArrayList;
import java.util.Collection;
import org.jvoicexml.xml.VoiceXmlNode;
import org.jvoicexml.xml.XmlNode;
import org.jvoicexml.xml.XmlNodeFactory;
import org.w3c.dom.Node;
/**
* A mark element is an empty element that places a marker into the text/tag
* sequence.
*
* @author Steve Doyle
* @version $Revision$
*/
public final class Mark
extends AbstractSsmlNode implements VoiceXmlNode {
/** Name of the tag. */
public static final String TAG_NAME = "mark";
/**
* Name of the mark.
*/
public static final String ATTRIBUTE_NAME = "name";
/**
* An ECMAScript expression which evaluates to the name of the mark. If
* nameexpr cannot be evaluated, an error.semantic event is thrown.
*/
public static final String ATTRIBUTE_NAMEEXPR = "nameexpr";
/**
* Supported attribute names for this node.
*/
protected static final ArrayList ATTRIBUTE_NAMES;
/**
* Set the valid attributes for this node.
*/
static {
ATTRIBUTE_NAMES = new java.util.ArrayList();
ATTRIBUTE_NAMES.add(ATTRIBUTE_NAME);
ATTRIBUTE_NAMES.add(ATTRIBUTE_NAMEEXPR);
}
/**
* Construct a new mark object without a node.
*
* This is necessary for the node factory.
*
*
* @see SsmlNodeFactory
*/
public Mark() {
super(null);
}
/**
* Construct a new mark object.
* @param node The encapsulated node.
*/
Mark(final Node node) {
super(node);
}
/**
* Constructs a new node.
*
* @param n
* The encapsulated node.
* @param factory
* The node factory to use.
*/
private Mark(final Node n,
final XmlNodeFactory extends XmlNode> factory) {
super(n, factory);
}
/**
* Get the name of the tag for the derived node.
*
* @return name of the tag.
*/
public String getTagName() {
return TAG_NAME;
}
/**
* {@inheritDoc}
*/
public XmlNode newInstance(final Node n,
final XmlNodeFactory extends XmlNode> factory) {
return new Mark(n, factory);
}
/**
* Retrieve the name attribute.
* @return Value of the name attribute.
* @see #ATTRIBUTE_NAME
*/
public String getName() {
return getAttribute(ATTRIBUTE_NAME);
}
/**
* Set the name attribute.
* @param name Value of the name attribute.
* @see #ATTRIBUTE_NAME
*/
public void setName(final String name) {
setAttribute(ATTRIBUTE_NAME, name);
}
/**
* Retrieve the nameexpr attribute.
* @return Value of the nameexpr attribute.
* @see #ATTRIBUTE_NAMEEXPR
*/
public String getNameexpr() {
return getAttribute(ATTRIBUTE_NAMEEXPR);
}
/**
* Set the nameexpr attribute.
* @param nameexpr Value of the nameexpr attribute.
* @see #ATTRIBUTE_NAMEEXPR
*/
public void setNameexpr(final String nameexpr) {
setAttribute(ATTRIBUTE_NAMEEXPR, nameexpr);
}
/**
* {@inheritDoc}
*/
@Override
protected boolean canContainChild(final String tagName) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public Collection getAttributeNames() {
return ATTRIBUTE_NAMES;
}
}