jimm.twice.xml.dom
Class NamedAttributes

java.lang.Object
  extended byjimm.twice.xml.dom.Element
      extended byjimm.twice.xml.dom.NamedElement
          extended byjimm.twice.xml.dom.NamedAttributes
Direct Known Subclasses:
Tag, XMLDecl

public abstract class NamedAttributes
extends NamedElement

An abstract superclass for entities with names and attributes.

Author:
Jim Menard, jimm@io.com

Field Summary
protected  java.util.Map attrs
           
 
Fields inherited from class jimm.twice.xml.dom.NamedElement
name
 
Fields inherited from class jimm.twice.xml.dom.Element
CLOSE_TAG, OPEN_AND_CLOSE_TAG, OPEN_TAG
 
Constructor Summary
NamedAttributes(java.lang.String name)
          Constructor.
NamedAttributes(java.lang.String name, java.util.Map attrs)
          Constructor.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String key)
          Returns the specified attribute value.
 void setAttribute(java.lang.String key, java.lang.Object value)
          Sets the specified attribute to a new value.
 void writeAttributes(java.io.OutputStream out)
          Returns a string containing the attribute key/value pairs as XML.
 
Methods inherited from class jimm.twice.xml.dom.NamedElement
getName
 
Methods inherited from class jimm.twice.xml.dom.Element
writeTo, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attrs

protected java.util.Map attrs
Constructor Detail

NamedAttributes

public NamedAttributes(java.lang.String name)
Constructor.

Parameters:
name - the element's name

NamedAttributes

public NamedAttributes(java.lang.String name,
                       java.util.Map attrs)
Constructor.

Parameters:
name - the element's name
attrs - the element's attributes; may be null
Method Detail

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Sets the specified attribute to a new value.

Parameters:
key - the key

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Returns the specified attribute value.

Parameters:
key - the key
Returns:
the value; may be null

writeAttributes

public void writeAttributes(java.io.OutputStream out)
                     throws java.io.IOException
Returns a string containing the attribute key/value pairs as XML. Values are encoded.

Parameters:
out - the output writer
Throws:
java.io.IOException