in scala/xml
object Utility

object Utility
extends Object
with ScalaObject
with TokenTests

Utility functions for processing instances of bound and not bound XML classes, as well as escaping text nodes

Method Summary
final def appendEscapedQuoted(s: String, sb: StringBuffer): StringBuffer
     Appends "s" and escapes and " i s with \"
final def appendQuoted(s: String, sb: StringBuffer): StringBuffer
     Appends "s" if s does not contain ", 's' otherwise
final def collectNamespaces(nodes: Seq[Node]): Set[String]
     Returns a set of all namespaces used in a sequence of nodes and all their descendants, including the empty namespaces.
final def collectNamespaces(n: Node, set: Set[String]): Unit
     adds all namespaces in node to set
final def escape(text: String): String
final def escape(text: String, s: StringBuffer): StringBuffer
final def hashCode(pre: String, label: String, attribHashCode: Int, scpeHash: Int, children: Seq[Node]): Int
     Returns a hashcode for the given constituents of a node
  def hashCode(): Int
final def prefix(name: String): Option[String]
     returns prefix of qualified name if any
final def publicLiteralToString(s: String): String
final def publicLiteralToString(sb: StringBuffer, s: String): StringBuffer
final def systemLiteralToString(s: String): String
     Returns a hashcode for the given constituents of a node
final def systemLiteralToString(sb: StringBuffer, s: String): StringBuffer
final def toXML(n: Node): String
     string representation of an XML node, with comments stripped the comments
final def toXML(n: Node, stripComment: Boolean): String
     String representation of a Node.
final def toXML(x: Node, pscope: NamespaceBinding, sb: StringBuffer, stripComment: Boolean): Unit
     appends a tree to the given stringbuffer within given namespace scope.
final def view(s: String): Text

Method Detail

view

  final def view(s: String): Text

escape

  final def escape(text: String): String

escape

  final def escape(text: String, s: StringBuffer): StringBuffer

collectNamespaces

  final def collectNamespaces(nodes: Seq[Node]): Set[String]
Returns a set of all namespaces used in a sequence of nodes and all their descendants, including the empty namespaces.
Parameters:
nodes -

collectNamespaces

  final def collectNamespaces(n: Node, set: Set[String]): Unit
adds all namespaces in node to set

toXML

  final def toXML(n: Node): String
string representation of an XML node, with comments stripped the comments
See Also:
"toXML(Node, Boolean)"

toXML

  final def toXML(n: Node, stripComment: Boolean): String
String representation of a Node. uses namespace mapping from defaultPrefixes(n).
Parameters:
n -
stripComment -
Todo:
define a way to escape literal characters to &xx; references

toXML

  final def toXML(x: Node, pscope: NamespaceBinding, sb: StringBuffer, stripComment: Boolean): Unit
appends a tree to the given stringbuffer within given namespace scope.
Parameters:
n - the node
pscope - the parent scope
sb - stringbuffer to append to
stripComment - if true, strip comments

prefix

  final def prefix(name: String): Option[String]
returns prefix of qualified name if any

hashCode

  final def hashCode(pre: String, label: String, attribHashCode: Int, scpeHash: Int, children: Seq[Node]): Int
Returns a hashcode for the given constituents of a node
Parameters:
uri -
label -
attribHashCode -
children -

hashCode

  def hashCode(): Int

systemLiteralToString

  final def systemLiteralToString(s: String): String
Returns a hashcode for the given constituents of a node
Parameters:
uri -
label -
attribs -
children - def hashCode(uri: String, label: String, attribs: scala.collection.mutable.HashMap[Pair[String,String],String], scpe: Int, children: Seq[Node]): Int = { 41 * uri.hashCode() % 7 + label.hashCode() + attribs.toList.hashCode() + scpe + children.hashCode() }

systemLiteralToString

  final def systemLiteralToString(sb: StringBuffer, s: String): StringBuffer

publicLiteralToString

  final def publicLiteralToString(s: String): String

publicLiteralToString

  final def publicLiteralToString(sb: StringBuffer, s: String): StringBuffer

appendQuoted

  final def appendQuoted(s: String, sb: StringBuffer): StringBuffer
Appends "s" if s does not contain ", 's' otherwise
Parameters:
s -
sb -

appendEscapedQuoted

  final def appendEscapedQuoted(s: String, sb: StringBuffer): StringBuffer
Appends "s" and escapes and " i s with \"
Parameters:
s -
sb -