in scala/xml
object Utility

object Utility
extends Object
with ScalaObject

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

Field Summary
final val noPrefixes: Map[String,String]
     a prefix mapping that maps the empty namespace to the empty prefix

Method Summary
final def appendEscapedQuoted(s: String, sb: StringBuffer): Unit
     appends "s" and escapes and " i s with \"
final def appendPrefixedName(ns: String, name: String, pmap: Map[String,String], sb: StringBuffer): Unit
final def appendQuoted(s: String, sb: StringBuffer): Unit
     appends "s" if s does not contain ", 's' otherwise
final def attr2xml(ns: String, attrib: Iterator[Attribute], pmap: Map[String,String], sb: StringBuffer): Unit
     for a Node n, returns string representation of n.attributes *
final def collectNamespaces(node: Node): Set[String]
     returns a set of all namespaces appearing in a node and all its descendants, including the empty namespaces
final def collectNamespaces(nodes: Seq[Node]): Set[String]
     returns a set of all namespaces appearing in a sequence of nodes and all their descendants, including the empty namespaces
final def defaultPrefixes(rootns: String, nset: Set[String]): Map[String,String]
     returns a default prefix mapping for a set of namespaces.
final def defaultPrefixes(n: Node): Map[String,String]
     same as defaultPrefixes(n.namespace, collectNamespaces( n ))
final def defaultPrefixes(nodes: Seq[Node]): Map[String,String]
     same as defaultPrefixes("", ncollectNamespaces( nodes ))
final def escape(text: String): String
     representation of text in a string that is well-formed XML.
final def hashCode(uri: String, label: String, attribHashCode: Int, children: Seq[Node]): Int
     returns a hashcode for the given constituents of a node
final def hashCode(uri: String, label: String, attribs: HashMap[Tuple2[String,String],String], children: Seq[Node]): Int
     returns a hashcode for the given constituents of a node
final def publicLiteralToString(s: String): String
final def systemLiteralToString(s: String): String
final def toXML(n: Node): String
     serializes an instance of Node to a string that contains well-formed XML
final def toXML(x: Node, pmap: Map[String,String]): String
     serializes a node with given namespace prefix mapping.
final def toXML(x: Node, pmap: Map[String,String], sb: StringBuffer): Unit
     serializes a tree to the given stringbuffer with the given namespace prefix mapping
final def toXML1(x: Node, pmap: Map[String,String], sb: StringBuffer): Unit
     serializes a tree to the given stringbuffer with the given namespace prefix mapping
final def view(s: String): Text

Field Detail

noPrefixes

  final val noPrefixes: Map[String,String]
a prefix mapping that maps the empty namespace to the empty prefix
Method Detail

view

  final def view(s: String): Text

escape

  final def escape(text: String): String
representation of text in a string that is well-formed XML. the characters < > & and " are escaped

collectNamespaces

  final def collectNamespaces(node: Node): Set[String]
returns a set of all namespaces appearing in a node and all its descendants, including the empty namespaces

collectNamespaces

  final def collectNamespaces(nodes: Seq[Node]): Set[String]
returns a set of all namespaces appearing in a sequence of nodes and all their descendants, including the empty namespaces

defaultPrefixes

  final def defaultPrefixes(rootns: String, nset: Set[String]): Map[String,String]
returns a default prefix mapping for a set of namespaces. the empty namespace is mapped to the empty prefix

defaultPrefixes

  final def defaultPrefixes(n: Node): Map[String,String]
same as defaultPrefixes(n.namespace, collectNamespaces( n ))

defaultPrefixes

  final def defaultPrefixes(nodes: Seq[Node]): Map[String,String]
same as defaultPrefixes("", ncollectNamespaces( nodes ))

toXML

  final def toXML(n: Node): String
serializes an instance of Node to a string that contains well-formed XML
Todo:
define a way to escape literal characters to &xx; references

toXML

  final def toXML(x: Node, pmap: Map[String,String]): String
serializes a node with given namespace prefix mapping. the prefix mapping may not map the empty namespace "" to some non-empty prefix.
Arg:
n the node to serialize
Pmap:
a mapping from namespace URIs to prefixes

toXML

  final def toXML(x: Node, pmap: Map[String,String], sb: StringBuffer): Unit
serializes a tree to the given stringbuffer with the given namespace prefix mapping
Parameters:
n - the root node

toXML1

  final def toXML1(x: Node, pmap: Map[String,String], sb: StringBuffer): Unit
serializes a tree to the given stringbuffer with the given namespace prefix mapping
Parameters:
n - the root node

attr2xml

  final def attr2xml(ns: String, attrib: Iterator[Attribute], pmap: Map[String,String], sb: StringBuffer): Unit
for a Node n, returns string representation of n.attributes *

hashCode

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

hashCode

  final def hashCode(uri: String, label: String, attribs: HashMap[Tuple2[String,String],String], children: Seq[Node]): Int
returns a hashcode for the given constituents of a node

systemLiteralToString

  final def systemLiteralToString(s: String): String

publicLiteralToString

  final def publicLiteralToString(s: String): String

appendPrefixedName

  final def appendPrefixedName(ns: String, name: String, pmap: Map[String,String], sb: StringBuffer): Unit

appendQuoted

  final def appendQuoted(s: String, sb: StringBuffer): Unit
appends "s" if s does not contain ", 's' otherwise

appendEscapedQuoted

  final def appendEscapedQuoted(s: String, sb: StringBuffer): Unit
appends "s" and escapes and " i s with \"