Class DOMSerializer

java.lang.Object
com.jme3.export.xml.DOMSerializer

public class DOMSerializer extends Object
The DOMSerializer was based primarily off the DOMSerializer.java class from the "Java and XML" 3rd Edition book by Brett McLaughlin, and Justin Edelson. Some modifications were made to support formatting of elements and attributes.
  • Constructor Details

    • DOMSerializer

      public DOMSerializer()
  • Method Details

    • serialize

      public void serialize(Document doc, File file) throws IOException
      Serialize doc to out
      Parameters:
      doc - the document to serialize.
      file - the file to serialize to.
      Throws:
      IOException - for various error conditions
    • serialize

      public void serialize(Document doc, OutputStream out) throws IOException
      Serialize doc to out
      Parameters:
      doc - the document to serialize.
      out - the stream to serialize to.
      Throws:
      IOException - for various error conditions
    • setEncoding

      public void setEncoding(String encoding)
      Set the encoding used by this serializer.
      Parameters:
      encoding - the encoding to use, passing in null results in the default encoding (UTF-8) being set.
    • setIndent

      public void setIndent(int indent)
      Set the number of spaces to use for indentation.

      The default is to use 4 spaces.

      Parameters:
      indent - the number of spaces to use for indentation, values less than or equal to zero result in no indentation being used.
    • setLineSeparator

      public void setLineSeparator(String lineSeparator)
      Set the line separator that will be used when serializing documents.

      If this is not called then the serializer uses a default based on the line.separator system property.

      Parameters:
      lineSeparator - the line separator to set.