ptolemy.data
Class XMLToken

java.lang.Object
  extended by ptolemy.data.Token
      extended by ptolemy.data.XMLToken
All Implemented Interfaces:
java.io.Serializable

public class XMLToken
extends Token

A token that contains a xml document. Currently, no operations between function tokens (add, multiply, etc.) are supported.

Since:
Ptolemy II 4.0
Version:
$Id: XMLToken.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Yang Zhao
See Also:
Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (neuendor)

Field Summary
private  org.w3c.dom.Document _doc
           
private  java.lang.String _toString
           
 
Fields inherited from class ptolemy.data.Token
NIL
 
Constructor Summary
XMLToken()
          Construct an empty token.
XMLToken(java.lang.String init)
          Construct an XmlToken from the specified string.
 
Method Summary
static XMLToken convert(Token token)
          Convert the specified token into an instance of XMLToken.
 org.w3c.dom.Document getDomTree()
          Return the dom document parsed from the xml string.
 Type getType()
          Return the type of this token.
 java.lang.String toString()
          Return the value of this Token as a string.
 
Methods inherited from class ptolemy.data.Token
add, addReverse, divide, divideReverse, isCloseTo, isCloseTo, isEqualTo, isNil, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_doc

private org.w3c.dom.Document _doc

_toString

private java.lang.String _toString
Constructor Detail

XMLToken

public XMLToken()
Construct an empty token.


XMLToken

public XMLToken(java.lang.String init)
         throws java.lang.Exception
Construct an XmlToken from the specified string.

Parameters:
init - The initialization string.
Throws:
java.lang.Exception - If the string is not parsable.
Method Detail

convert

public static XMLToken convert(Token token)
                        throws IllegalActionException
Convert the specified token into an instance of XMLToken. If the specified token is not an instance of XMLToken, an exception is thrown.

Parameters:
token - The token to be converted to a XMLToken.
Returns:
A XMLToken.
Throws:
IllegalActionException - If the conversion cannot be carried out.

getDomTree

public org.w3c.dom.Document getDomTree()
Return the dom document parsed from the xml string.

Returns:
A Document.

getType

public Type getType()
Return the type of this token.

Overrides:
getType in class Token
Returns:
BaseType.XMLTOKEN.

toString

public java.lang.String toString()
Return the value of this Token as a string.

Overrides:
toString in class Token
Returns:
A String.