org.openstreetmap.josm.io
Class XmlWriter

java.lang.Object
  extended by org.openstreetmap.josm.io.XmlWriter
Direct Known Subclasses:
GpxWriter, OsmWriter

public class XmlWriter
extends java.lang.Object

Helper class to use for xml outputting classes.


Field Summary
private static java.util.HashMap<java.lang.Character,java.lang.String> encoding
          The output writer to save the values to.
protected  java.io.PrintWriter out
           
 
Constructor Summary
XmlWriter(java.io.PrintWriter out)
           
 
Method Summary
static java.lang.String encode(java.lang.String unencoded)
           
static java.lang.String encode(java.lang.String unencoded, boolean keepApos)
          Encode the given string in XML1.0 format.
 void flush()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected java.io.PrintWriter out

encoding

private static final java.util.HashMap<java.lang.Character,java.lang.String> encoding
The output writer to save the values to.

Constructor Detail

XmlWriter

public XmlWriter(java.io.PrintWriter out)
Method Detail

flush

public void flush()

encode

public static java.lang.String encode(java.lang.String unencoded)

encode

public static java.lang.String encode(java.lang.String unencoded,
                                      boolean keepApos)
Encode the given string in XML1.0 format. Optimized to fast pass strings that don't need encoding (normal case).

Parameters:
unencoded - the unencoded input string
keepApos - true if apostrophe sign should stay as it is (in order to work around a Java bug that renders new JLabel("'") literally as 6 character string, see #7558)


JOSM