Class ElementWriter

java.lang.Object
org.openstreetmap.osmosis.xml.common.ElementWriter
Direct Known Subclasses:
BoundWriter, EntityWriter, OsmChangeWriter, OsmWriter, RelationMemberWriter, TagWriter, WayNodeWriter

public class ElementWriter extends Object
Provides common functionality for all classes writing elements to xml.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ElementWriter(String anElementName, int anIndentionLevel)
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addAttribute(String name, String value)
    Adds an attribute to the element.
    protected void
    Writes an element opening line without the final closing portion of the tag.
    protected void
    Writes the closing tag of the element.
    protected void
    endOpenElement(boolean closeElement)
    Writes out the opening tag of the element.
    protected org.openstreetmap.osmosis.core.domain.common.TimestampFormat
    Returns a timestamp format suitable for xml files.
    void
    setWriter(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 Details

    • ElementWriter

      protected ElementWriter(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 Details

    • setWriter

      public void setWriter(Writer aWriter)
      Sets the writer used as the xml output destination.
      Parameters:
      aWriter - The writer.
    • getTimestampFormat

      protected org.openstreetmap.osmosis.core.domain.common.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(String name, 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.