Joda System API

org.joda.property.xml
Class XMLData

java.lang.Object
  |
  +--org.joda.property.xml.XMLData

public class XMLData
extends java.lang.Object

Class defining a generic element and children structure for XML. It is a lightweight version of the DOM model.

Author:
Stephen Colebourne, Andy Lehane

Field Summary
static java.lang.String CDATA
           
static java.lang.String ID
           
static java.lang.String IDREF
           
 
Constructor Summary
XMLData(XMLData parent, java.lang.String localName)
          Constructor
XMLData(XMLData parent, XMLName name)
          Constructor
 
Method Summary
 XMLData addNewChild(java.lang.String localName)
          Create an XMLData child by name
 XMLData addNewChild(XMLName name)
          Create an XMLData child by name
 org.xml.sax.Attributes getAttributes()
          Get the attributes in SAX format
 java.lang.String getAttributeValue(XMLName name)
          Get an attribute value
 XMLData getChild(int index)
          Get an XMLData child by index
 XMLData getChild(java.lang.String name)
          Get an XMLData child by name
 XMLData getChild(XMLName name)
          Get an XMLData child by xml name
 java.util.List getChildren()
          Get XMLData children.
 java.lang.Object getContent()
          Get the content
 XMLName getName()
          Get the element name
 XMLData getParent()
          Get XMLData parent.
 java.lang.String getText()
          Get the text
 void putAttribute(java.lang.String localName, java.lang.String value)
          Set a normal (CDATA) attribute with no namespace.
 void putAttribute(XMLName name, java.lang.String value, java.lang.String type)
          Set an attribute
 void putAttributeMap(java.util.Map attributes)
          Set the map of attributes.
 void putAttributes(org.xml.sax.Attributes attributes)
          Set the map of attributes
 void removeAttribute(XMLName name)
          Remove an attribute value
 void setContent(java.lang.Object content)
          Set the element content
 void setName(XMLName name)
          Set the element name.
 void setText(java.lang.String text)
          Set the element text
 java.lang.String toString()
          Debugging toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CDATA

public static final java.lang.String CDATA
See Also:
Constant Field Values

ID

public static final java.lang.String ID
See Also:
Constant Field Values

IDREF

public static final java.lang.String IDREF
See Also:
Constant Field Values
Constructor Detail

XMLData

public XMLData(XMLData parent,
               java.lang.String localName)
Constructor


XMLData

public XMLData(XMLData parent,
               XMLName name)
Constructor

Method Detail

getName

public XMLName getName()
Get the element name


setName

public void setName(XMLName name)
Set the element name. Generally this should only be called for the root element, as the parent normally decides the name of its children.


getParent

public XMLData getParent()
Get XMLData parent. This normally should not be updated.


getChildren

public java.util.List getChildren()
Get XMLData children. This will be modifiable.


getChild

public XMLData getChild(java.lang.String name)
Get an XMLData child by name

Parameters:
name - the child name

getChild

public XMLData getChild(XMLName name)
Get an XMLData child by xml name

Parameters:
name - the child xml name

getChild

public XMLData getChild(int index)
Get an XMLData child by index

Parameters:
index - the child index

addNewChild

public XMLData addNewChild(java.lang.String localName)
Create an XMLData child by name


addNewChild

public XMLData addNewChild(XMLName name)
Create an XMLData child by name

Parameters:
name - the child name

getAttributeValue

public java.lang.String getAttributeValue(XMLName name)
Get an attribute value

Parameters:
name - the name to get
Returns:
the value

getAttributes

public org.xml.sax.Attributes getAttributes()
Get the attributes in SAX format

Returns:
the SAX Attributes object

removeAttribute

public void removeAttribute(XMLName name)
Remove an attribute value

Parameters:
name - the name to remove

putAttributes

public void putAttributes(org.xml.sax.Attributes attributes)
Set the map of attributes

Parameters:
attributes - add the attributes passed in to the attributes held

putAttributeMap

public void putAttributeMap(java.util.Map attributes)
Set the map of attributes. The attribute map should consist of simple String to String type attributes. No namespace will be assigned.

Parameters:
attributes - add the attributes passed in to the attributes held

putAttribute

public void putAttribute(java.lang.String localName,
                         java.lang.String value)
Set a normal (CDATA) attribute with no namespace.

Parameters:
localName -
value -

putAttribute

public void putAttribute(XMLName name,
                         java.lang.String value,
                         java.lang.String type)
Set an attribute

Parameters:
name - the xml name
value - the string value
type - the XML type, CDATA, ID or IDREF

getContent

public java.lang.Object getContent()
Get the content


setContent

public void setContent(java.lang.Object content)
Set the element content


getText

public java.lang.String getText()
Get the text


setText

public void setText(java.lang.String text)
Set the element text


toString

public java.lang.String toString()
Debugging toString

Overrides:
toString in class java.lang.Object

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.