org.jvoicexml.xml
Interface XmlNode

All Superinterfaces:
Node, XmlWritable
All Known Subinterfaces:
CcxmlNode, SrgsNode, SsmlNode, VoiceXmlNode
All Known Implementing Classes:
AbstractCatchElement, AbstractXmlNode, Accept, Assign, Assign, Audio, Block, Break, Cancel, Catch, Ccxml, Choice, Clear, Createcall, Createccxml, Createconference, Data, Desc, Destroyconference, Dialogprepare, Dialogstart, Dialogterminate, Disconnect, Disconnect, Else, Else, Elseif, Elseif, Emphasis, Enumerate, Error, Eventprocessor, Example, Exit, Exit, Fetch, Field, Filled, Foreach, Form, Goto, Goto, Grammar, Help, If, If, Initial, Item, Join, Lexicon, Link, Log, Log, Mark, Menu, Merge, Meta, Meta, Metadata, Metadata, Move, Noinput, Nomatch, ObjectTag, OneOf, Option, P, Param, Phoneme, Prompt, Property, Prosody, Record, Redirect, Reject, Reprompt, Return, Rule, Ruleref, S, SayAs, Script, Script, Send, Speak, Sub, Subdialog, Submit, Tag, Text, Text, Throw, Token, Transfer, Transition, Unjoin, Value, Var, Var, Voice, VoiceXmlComment, VoiceXmlDocumentType, Vxml, XmlCDataSection

public interface XmlNode
extends XmlWritable, Node

Base interface for all nodes in an XML document.

Since:
0.5
Version:
$Revision: 154 $

Copyright © 2006 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Dirk Schnelle
See Also:
XmlDocument

Field Summary
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Method Summary
 XmlNode addChild(String tagName)
          Adds an instance of the specified child class to this node.
 String getAttribute(String attribute)
          Convenient method to get the value of an attribute.
 Collection<String> getAttributeNames()
          Returns a collection of permitted attribute names for the node.
<T extends XmlNode>
Collection<T>
getChildNodes(Class<T> tagClass)
          Return a collection of child nodes with the specified tag class.
 Node getNode()
          Retrieves the encapsulated node.
 String getTagName()
          Retrieves the name of the tag for the derived node.
 XmlNode newInstance(Node n)
          Create a new instance for the given node.
 void setAttribute(String name, String value)
          Convenient method to set the value of an attribute.
 
Methods inherited from interface org.jvoicexml.xml.XmlWritable
writeChildrenXml, writeXml
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Method Detail

getNode

Node getNode()
Retrieves the encapsulated node.

Returns:
The encapsulated node.

getTagName

String getTagName()
Retrieves the name of the tag for the derived node.

Returns:
The name of the tag.

newInstance

XmlNode newInstance(Node n)
Create a new instance for the given node.

Each XmlNode can serve as a prototype in a XmlNodeFactory to produce a collection of child nodes. Factories can then use the prototype pattern to produce new nodes.

Parameters:
n - The node to encapsulate.
Returns:
The new instance.
See Also:
XmlNodeFactory

addChild

XmlNode addChild(String tagName)
Adds an instance of the specified child class to this node. This causes a new node to be created and appended to this node. The type of the node to add must be a subclass of the XmlNode class.

Parameters:
tagName - The tag name of the node to add.
Returns:
Newly created and appended node or null if the child is not allowed on this node.

getAttribute

String getAttribute(String attribute)
Convenient method to get the value of an attribute.

Parameters:
attribute - Name of the attribute.
Returns:
Value of theattribute, null if the value of the attribute cannot be retrieved.

setAttribute

void setAttribute(String name,
                  String value)
Convenient method to set the value of an attribute. If the assigned value is null then the attribute is removed.

Parameters:
name - Name of the attribute.
value - New value of the attribute or null to remove the attribute.

getAttributeNames

Collection<String> getAttributeNames()
Returns a collection of permitted attribute names for the node.

Returns:
A collection of attribute names that are allowed for the node
Since:
0.3.1

getChildNodes

<T extends XmlNode> Collection<T> getChildNodes(Class<T> tagClass)
Return a collection of child nodes with the specified tag class.

Type Parameters:
T - Type of the child nodes.
Parameters:
tagClass - Class of child node to return.
Returns:
A collection of child nodes of the specified type. If this node does not contain any child nodes of the specified type then an empty collection is returned.
Since:
0.5


Copyright © 2005-2007 JVoiceXML group.