scala.xml

object Utility

[source: scala/xml/Utility.scala]

object Utility
extends TokenTests
The Utility object provides utility functions for processing instances of bound and not bound XML classes, as well as escaping text nodes.
Author
Burak Emir
Method Summary
def appendEscapedQuoted (s : String, sb : StringBuilder) : StringBuilder
Appends "s" and escapes and " i s with \"
def appendQuoted (s : String, sb : StringBuilder) : StringBuilder
Appends "s" if string s does not contain ", 's' otherwise.
def checkAttributeValue (value : String) : String
Returns null if the value is a correct attribute value, error message if it isn't.
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.
def collectNamespaces (n : Node, set : Set[String]) : Unit
Adds all namespaces in node to set.
final def escape (text : String) : String
Escapes the characters < > & and " from string.
final def escape (text : String, s : StringBuilder) : StringBuilder
Appends escaped string to s.
def getName (s : String, index : Int) : String
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 parseAttributeValue (value : String) : Seq[Node]
new
def parseCharRef (ch : () => Char, nextch : () => Unit, reportSyntaxError : (String) => Unit) : String
     CharRef ::= "&#" '0'..'9' {'0'..'9'} ";"
               | "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";"
   

see [66]

final def prefix (name : String) : Option[String]
Returns prefix of qualified name if any.
def publicLiteralToString (s : String) : String
def publicLiteralToString (sb : StringBuilder, s : String) : StringBuilder
def sequenceToXML (children : Seq[Node], pscope : NamespaceBinding, sb : StringBuilder, stripComment : Boolean) : Unit
def sort (n : Node) : Node
returns the node with its attribute list sorted alphabetically (prefixes are ignored)
def sort (md : MetaData) : MetaData
returns a sorted attribute list
def systemLiteralToString (s : String) : String
def systemLiteralToString (sb : StringBuilder, s : String) : StringBuilder
def toXML (n : Node) : String
Returs the string representation of an XML node, with comments stripped the comments.
def toXML (x : Node, pscope : NamespaceBinding, sb : StringBuilder, stripComment : Boolean) : Unit
Appends a tree to the given stringbuffer within given namespace scope.
def toXML (n : Node, stripComment : Boolean) : String
Return the string representation of a Node. uses namespace mapping from defaultPrefixes(n).
def trim (x : Node) : Node
trims an element - call this method, when you know that it is an element (and not a text node) so you know that it will not be trimmed away. With this assumption, the function can return a Node, rather than a Seq[Node]. If you don't know, call trimProper and account for the fact that you may get back an empty sequence of nodes. precondition: node is not a text node (it might be trimmed)
def trimProper (x : Node) : Seq[Node]
trim a child of an element. Attribute values and Atom nodes that are not Text nodes are unaffected
final def unescape (ref : String, s : StringBuilder) : StringBuilder
Appends unescaped string to s, amp becomes & lt becomes < etc..
def view (s : String) : Text
Methods inherited from TokenTests
isSpace, isSpace, isNameChar, isNameStart, isName, isPubIDChar, isValidIANAEncoding, checkSysID, checkPubID
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf