org.exolab.castor.xml

Class NodeType


public final class NodeType
extends java.lang.Object

The possible node types for an XML field. A field can be represented as an attribute, an element or text content. The default is attribute. This class is essentially a typesafe enumeration and the instances are immutable.
Version:
$Revision: 6761 $ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $
Authors:
Assaf Arkin
Keith Visco

Field Summary

static short
ATTRIBUTE
The attribute type.
static NodeType
Attribute
Attribute node type (attribute).
static short
ELEMENT
The element type.
static NodeType
Element
Element node type (element).
static short
NAMESPACE
The namespace node type.
static NodeType
Namespace
Namespace node type (namespace).
static short
TEXT
The text type.
static NodeType
Text
Content node type (text).

Method Summary

static NodeType
getNodeType(String nodeType)
Returns the node type from the name.
short
getType()
Returns the type of this NodeType.
String
toString()
Returns the name of this NodeType.

Field Details

ATTRIBUTE

public static final short ATTRIBUTE
The attribute type.
Field Value:
0

Attribute

public static final NodeType Attribute
Attribute node type (attribute). This field will appear in the XML document as an element's attribute.

ELEMENT

public static final short ELEMENT
The element type.
Field Value:
1

Element

public static final NodeType Element
Element node type (element). This field will appear in the XML document as a contained element.

NAMESPACE

public static final short NAMESPACE
The namespace node type.
Field Value:
2

Namespace

public static final NodeType Namespace
Namespace node type (namespace). This field will appear in the XML document as a namespace declaration.

TEXT

public static final short TEXT
The text type.
Field Value:
3

Text

public static final NodeType Text
Content node type (text). This field will appear in the XML document as the element text content.

Method Details

getNodeType

public static NodeType getNodeType(String nodeType)
Returns the node type from the name. If nodeType is null, return the default node type (Attribute). Otherwise returns the named node type mode.
Parameters:
nodeType - The node type name
Returns:
The node type

getType

public short getType()
Returns the type of this NodeType.
Returns:
the type of this NodeType.

toString

public String toString()
Returns the name of this NodeType.
Returns:
the name of this NodeType.

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com