BeanIO 1.2.3

org.beanio.parser.xml
Class XmlDefinition

java.lang.Object
  extended by org.beanio.parser.xml.XmlDefinition

public class XmlDefinition
extends Object

Stores common attributes used to define a XML node.

Although not enforced, namespace and prefix should be set to null if this node is not namespace aware. Note that the document object model (DOM) does not support empty string namespaces to indicate xmlns="".

Since:
1.1
Author:
Kevin Seim

Field Summary
static int XML_TYPE_ATTRIBUTE
          Attribute XML node type
static int XML_TYPE_ELEMENT
          Element XML node type
static int XML_TYPE_NONE
          XML type indicating no node
static int XML_TYPE_TEXT
          Text XML node type
 
Constructor Summary
XmlDefinition()
          Constructs a new XmlDefinition.
 
Method Summary
 String getName()
          Returns the XML local name for this node.
 String getNamespace()
          Returns the namespace of this node.
 String getPrefix()
          Returns the namespace prefix for marshaling this node, or null if the namespace should override the default namespace.
 int getType()
          Returns the XML node type.
 XmlDefinition getWrapper()
          Returns the XML element for wrapping this XML node.
 boolean isAttribute()
          Returns true if the XML node type is attribute.
 boolean isElement()
          Returns true if the XML node type is element.
 boolean isNamespaceAware()
          Returns true if a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.
 boolean isNillable()
          Returns whether this node is nillable.
 boolean isNode()
          Returns true if the XML node type is not none.
 boolean isWrapped()
          Returns whether this XML node is wrapped by another element.
 void setName(String name)
          Sets the XML local name for this node.
 void setNamespace(String namespace)
          Sets the namespace of this node.
 void setNamespaceAware(boolean namespaceAware)
          Sets whether this node is namespace aware.
 void setNillable(boolean nillable)
          Sets whether this node is nillable.
 void setPrefix(String prefix)
          Sets the namespace prefix for marshaling the node.
 void setType(int xmlType)
          Sets the type of XML node.
 void setWrapper(XmlDefinition wrapper)
          Sets the XML element for wrapping this XML node.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_TYPE_TEXT

public static final int XML_TYPE_TEXT
Text XML node type

See Also:
Constant Field Values

XML_TYPE_ELEMENT

public static final int XML_TYPE_ELEMENT
Element XML node type

See Also:
Constant Field Values

XML_TYPE_ATTRIBUTE

public static final int XML_TYPE_ATTRIBUTE
Attribute XML node type

See Also:
Constant Field Values

XML_TYPE_NONE

public static final int XML_TYPE_NONE
XML type indicating no node

See Also:
Constant Field Values
Constructor Detail

XmlDefinition

public XmlDefinition()
Constructs a new XmlDefinition.

Method Detail

getType

public int getType()
Returns the XML node type.

Returns:
one of XML_TYPE_NONE, XML_TYPE_ELEMENT, XML_TYPE_ATTRIBUTE, or XML_TYPE_TEXT

setType

public void setType(int xmlType)
Sets the type of XML node.

Parameters:
xmlType - one of XML_TYPE_NONE, XML_TYPE_ELEMENT, XML_TYPE_ATTRIBUTE, or XML_TYPE_TEXT

getName

public String getName()
Returns the XML local name for this node.

Returns:
the XML local name

setName

public void setName(String name)
Sets the XML local name for this node.

Parameters:
name - the XML local name

getNamespace

public String getNamespace()
Returns the namespace of this node. If there is no namespace for this node, or this node is not namespace aware, null is returned.

Returns:
the XML namespace of this node

setNamespace

public void setNamespace(String namespace)
Sets the namespace of this node. If there is no namespace for this node, or this node is not namespace aware, the namespace must be null.

Parameters:
namespace - the XML namespace

setNamespaceAware

public void setNamespaceAware(boolean namespaceAware)
Sets whether this node is namespace aware.

Parameters:
namespaceAware - true if this node uses a namespace for unmarshaling and marshaling this node

isNamespaceAware

public boolean isNamespaceAware()
Returns true if a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.

Returns:
true if this node uses a namespace for matching and formatting this node

getPrefix

public String getPrefix()
Returns the namespace prefix for marshaling this node, or null if the namespace should override the default namespace.

Returns:
the namespace prefix

setPrefix

public void setPrefix(String prefix)
Sets the namespace prefix for marshaling the node. If set to null the namespace will override the default namespace when this node is marshaled.

Parameters:
prefix - the namespace prefix

isNillable

public boolean isNillable()
Returns whether this node is nillable.

Returns:
true if this node is nillable

setNillable

public void setNillable(boolean nillable)
Sets whether this node is nillable.

Parameters:
nillable - set to true if this node is nillable

isNode

public boolean isNode()
Returns true if the XML node type is not none.

Returns:
true if the XML node type is not none

isElement

public boolean isElement()
Returns true if the XML node type is element.

Returns:
true if the XML node type is element

isAttribute

public boolean isAttribute()
Returns true if the XML node type is attribute.

Returns:
true if the XML node type is attribute

getWrapper

public XmlDefinition getWrapper()
Returns the XML element for wrapping this XML node.

Returns:
the XML wrapper element

setWrapper

public void setWrapper(XmlDefinition wrapper)
Sets the XML element for wrapping this XML node.

Parameters:
wrapper - the XML wrapper element

isWrapped

public boolean isWrapped()
Returns whether this XML node is wrapped by another element.

Returns:
true if this XML node is wrapped by another element

toString

public String toString()
Overrides:
toString in class Object

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim