com.openharbor.beck.xml
Class XMLThing

java.lang.Object
  extended bycom.openharbor.beck.xml.XMLThing

public class XMLThing
extends java.lang.Object

An XML attribute or element (not including nested elements). When representing an attribute, getAttributes() == null. Immutable.


Constructor Summary
XMLThing(XMLName name, java.lang.String value)
          Construct an attribute.
XMLThing(XMLName name, java.lang.String value, java.util.Map attributes)
          Construct an element or (if attributes==null) an attribute.
 
Method Summary
static java.lang.String enquoteAttributeValue(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 java.util.Map getAttributes()
           
 XMLName getName()
           
 java.lang.Object getSource()
          A hint about the source of this thing.
 Type getType()
          A hint about the structural type of this thing.
 java.lang.String getValue()
           
 int hashCode()
           
 boolean isAttribute()
           
 void setSource(java.lang.Object source)
           
 void setType(Type type)
           
 java.lang.String toString()
           
 java.lang.String toString(Prefixer prefixer)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLThing

public XMLThing(XMLName name,
                java.lang.String value)
Construct an attribute.

Parameters:
name - attribute name
value - attribute value

XMLThing

public XMLThing(XMLName name,
                java.lang.String value,
                java.util.Map attributes)
Construct an element or (if attributes==null) an attribute. To construct an element with no attributes, pass Collections.EMPTY_MAP to the attributes parameter.

Parameters:
name - element name
value - text contained in the element
attributes - attributes of the element
Method Detail

getName

public XMLName getName()

getValue

public java.lang.String getValue()

getAttributes

public java.util.Map getAttributes()

isAttribute

public final boolean isAttribute()

getSource

public java.lang.Object getSource()
A hint about the source of this thing. This does not affect the computation of equals() or hashCode().

Returns:
the Object from which this thing was copied, or null if the source is unknown.

setSource

public void setSource(java.lang.Object source)

getType

public Type getType()
A hint about the structural type of this thing. This does not affect the computation of equals() or hashCode().

Returns:
the structural type of this thing, or null if its type is unknown.

setType

public void setType(Type type)

toString

public java.lang.String toString()

toString

public java.lang.String toString(Prefixer prefixer)

enquoteAttributeValue

public static java.lang.String enquoteAttributeValue(java.lang.Object o)
Returns:
o.toString(), enquoted as an XML attribute value.

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()