in scala/xml
class PrettyPrinter

class PrettyPrinter(width: Int, step: Int)
extends Object
with ScalaObject

Class for pretty printing. After instantiating, you can use the toPrettyXML methods to convert XML to a formatted string. The class can be reused to pretty print any number of XML nodes.
Parameters:
width - the width to fit the output into
Step:
indentation

Method Summary
protected def breakable(n: Node): Boolean
protected var cur: Int
protected def cut(s: String, ind: Int): List[Item]
  def format(n: Node, pmap: Map[String,String], sb: StringBuffer): Unit
     appends a formatted string containing well-formed XML with given namespace to prefix mapping to the given stringbuffer
  def format(n: Node): String
     returns a formatted string containing well-formed XML with default namespace prefix mapping
  def format(n: Node, pmap: Map[String,String]): String
     returns a formatted string containing well-formed XML with given namespace to prefix mapping
  def format(nodes: Seq[Node]): String
  def format(nodes: Seq[Node], pmap: Map[String,String]): String
     returns a formatted string containing well-formed XML
  def format(nodes: Seq[Node], pmap: Map[String,String], sb: StringBuffer): Unit
     appends a formatted string containing well-formed XML with the given namespace to prefix mapping to the given stringbuffer
protected var items: List[Item]
protected def leafTag(n: Node): String
protected def makeBox(ind: Int, s: String): Unit
     try to make indented box, if possible, else para
protected def makeBreak(): Unit
protected def makePara(ind: Int, s: String): Unit
protected var pmap: Map[String,String]
protected def reset(): Unit
protected def startTag(n: Node): String
protected def traverse(node: Node, ind: Int): Unit
protected def traverse(it: Iterator[Node], ind: Int): Unit

Methods inherited from java/lang/Object-class
clone, eq, equals, finalize, getClass, hashCode, notify, notifyAll, synchronized, toString, wait, wait, wait

Methods inherited from scala/Any-class
!=, ==, asInstanceOf, isInstanceOf, match

Object Summary
case object Break

Class Summary
case class Box(col: Int, s: String)
  class BrokenException()
  class Item()
case class Para(s: String)

Method Detail

items

  protected var items: List[Item]

cur

  protected var cur: Int

pmap

  protected var pmap: Map[String,String]

reset

  protected def reset(): Unit

cut

  protected def cut(s: String, ind: Int): List[Item]

makeBox

  protected def makeBox(ind: Int, s: String): Unit
try to make indented box, if possible, else para

makePara

  protected def makePara(ind: Int, s: String): Unit

makeBreak

  protected def makeBreak(): Unit

leafTag

  protected def leafTag(n: Node): String

startTag

  protected def startTag(n: Node): String

format

  def format(n: Node, pmap: Map[String,String], sb: StringBuffer): Unit
appends a formatted string containing well-formed XML with given namespace to prefix mapping to the given stringbuffer
Parameters:
n - the node to be serialized
pmap - the namespace to prefix mapping
sb - the stringbuffer to append to

format

  def format(n: Node): String
returns a formatted string containing well-formed XML with default namespace prefix mapping
Parameters:
n - the node to be serialized

format

  def format(n: Node, pmap: Map[String,String]): String
returns a formatted string containing well-formed XML with given namespace to prefix mapping
Parameters:
n - the node to be serialized
pmap - the namespace to prefix mapping

format

  def format(nodes: Seq[Node]): String

format

  def format(nodes: Seq[Node], pmap: Map[String,String]): String
returns a formatted string containing well-formed XML
Parameters:
nodes - the sequence of nodes to be serialized
pmap - the namespace to prefix mapping

format

  def format(nodes: Seq[Node], pmap: Map[String,String], sb: StringBuffer): Unit
appends a formatted string containing well-formed XML with the given namespace to prefix mapping to the given stringbuffer
Parameters:
n - the node to be serialized
pmap - the namespace to prefix mapping
sb - the string buffer to which to append to

breakable

  protected def breakable(n: Node): Boolean

traverse

  protected def traverse(node: Node, ind: Int): Unit
Parameters:
tail: - what we'd like to sqeeze in

traverse

  protected def traverse(it: Iterator[Node], ind: Int): Unit