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

org.jvoicexml.xml.pls.Grapheme Maven / Gradle / Ivy

The newest version!
/*
 * JVoiceXML - A free VoiceXML implementation.
 *
 * Copyright (C) 2005-2018 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.pls;

import org.jvoicexml.xml.Text;
import org.jvoicexml.xml.XmlNode;
import org.jvoicexml.xml.XmlNodeFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

/**
 * A <lexeme> contains at least one
 * <grapheme> element. The <grapheme>
 * element contains text describing the orthography of the
 * <lexeme>.
 *
 * @author Dirk Schnelle-Walka
 */
public final class Grapheme
        extends AbstractPlsNode {
    /** Name of the tag. */
    public static final String TAG_NAME = "grapheme";

    /**
     * Construct a new grapheme object without a node.
     * 

* This is necessary for the node factory. *

* * @see PlsNodeFactory */ public Grapheme() { super(null); } /** * Construct a new grapheme object. * @param node The encapsulated node. */ Grapheme(final Node node) { super(node); } /** * Constructs a new node. * * @param n * The encapsulated node. * @param factory * The node factory to use. */ private Grapheme(final Node n, final XmlNodeFactory 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 factory) { return new Grapheme(n, factory); } /** * {@inheritDoc} */ @Override protected boolean canContainChild(final String tagName) { return false; } /** * Create a new text within this grapheme element. * @param text The text to be added. * @return The new created text. */ public Text addText(final String text) { final Document document = getOwnerDocument(); final Node node = document.createTextNode(text); final Text textNode = new Text(node, getNodeFactory()); appendChild(textNode); return textNode; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy