org.openstreetmap.osmosis.core.xml.common
Class ElementWriter

java.lang.Object
  extended by org.openstreetmap.osmosis.core.xml.common.ElementWriter
Direct Known Subclasses:
BoundWriter, BoundWriter, NodeWriter, NodeWriter, OsmChangeWriter, OsmChangeWriter, OsmWriter, OsmWriter, RelationMemberWriter, RelationMemberWriter, RelationWriter, RelationWriter, TagWriter, TagWriter, WayNodeWriter, WayNodeWriter, WayWriter, WayWriter

public class ElementWriter
extends java.lang.Object

Provides common functionality for all classes writing elements to xml.

Author:
Brett Henderson

Constructor Summary
protected ElementWriter(java.lang.String anElementName, int anIndentionLevel)
          Creates a new instance.
 
Method Summary
protected  void addAttribute(java.lang.String name, java.lang.String value)
          Adds an attribute to the element.
protected  void beginOpenElement()
          Writes an element opening line without the final closing portion of the tag.
protected  void closeElement()
          Writes the closing tag of the element.
protected  void endOpenElement(boolean closeElement)
          Writes out the opening tag of the element.
protected  TimestampFormat getTimestampFormat()
          Returns a timestamp format suitable for xml files.
 void setWriter(java.io.Writer aWriter)
          Sets the writer used as the xml output destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementWriter

protected ElementWriter(java.lang.String anElementName,
                        int anIndentionLevel)
Creates a new instance.

Parameters:
anElementName - The name of the element to be written.
anIndentionLevel - The indent level of the element.
Method Detail

setWriter

public void setWriter(java.io.Writer aWriter)
Sets the writer used as the xml output destination.

Parameters:
aWriter - The writer.

getTimestampFormat

protected TimestampFormat getTimestampFormat()
Returns a timestamp format suitable for xml files.

Returns:
The timestamp format.

beginOpenElement

protected void beginOpenElement()
Writes an element opening line without the final closing portion of the tag.


endOpenElement

protected void endOpenElement(boolean closeElement)
Writes out the opening tag of the element.

Parameters:
closeElement - If true, the element will be closed immediately and written as a single tag in the output xml file.

addAttribute

protected void addAttribute(java.lang.String name,
                            java.lang.String value)
Adds an attribute to the element.

Parameters:
name - The name of the attribute.
value - The value of the attribute.

closeElement

protected void closeElement()
Writes the closing tag of the element.