jimm.twice.xml.dom
Class NamedAttributes
java.lang.Object
jimm.twice.xml.dom.Element
jimm.twice.xml.dom.NamedElement
jimm.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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
attrs
protected java.util.Map attrs
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 nameattrs
- the element's attributes; may be null
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