|
Scala Library
|
|
scala/xml/Utility.scala]
object
Utility
extends TokenTestsUtility object provides utility functions for processing
instances of bound and not bound XML classes, as well as escaping text nodes.| Method Summary | |
def
|
appendEscapedQuoted
(s : java.lang.String, sb : StringBuilder) : StringBuilder
Appends "s" and escapes and " i s with \"
|
def
|
appendQuoted
(s : java.lang.String, sb : StringBuilder) : StringBuilder
Appends "s" if string
s does not contain ",
's' otherwise. |
def
|
appendQuoted (s : java.lang.String) : java.lang.String |
def
|
checkAttributeValue
(value : java.lang.String) : java.lang.String
Returns
null if the value is a correct attribute value,
error message if it isn't. |
def
|
collectNamespaces
(n : Node, set : Set[java.lang.String]) : Unit
Adds all namespaces in node to set.
|
def
|
collectNamespaces
(nodes : Seq[Node]) : Set[java.lang.String]
Returns a set of all namespaces used in a sequence of nodes
and all their descendants, including the empty namespaces.
|
final def
|
escape
(text : java.lang.String, s : StringBuilder) : StringBuilder
Appends escaped string to
s. |
final def
|
escape
(text : java.lang.String) : java.lang.String
Escapes the characters < > & and " from string.
|
def
|
getName (s : java.lang.String, index : Int) : java.lang.String |
def
|
hashCode
(pre : java.lang.String, label : java.lang.String, attribHashCode : Int, scpeHash : Int, children : Seq[Node]) : Int
Returns a hashcode for the given constituents of a node
|
def
|
parseAttributeValue
(value : java.lang.String) : Seq[Node]
new
|
def
|
parseCharRef
(ch : () => Char, nextch : () => Unit, reportSyntaxError : (java.lang.String) => Unit) : java.lang.String
CharRef ::= "&#" '0'..'9' {'0'..'9'} ";"
| "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";"
|
final def
|
prefix
(name : java.lang.String) : Option[java.lang.String]
Returns prefix of qualified name if any.
|
def
|
publicLiteralToString (s : java.lang.String) : java.lang.String |
def
|
publicLiteralToString (sb : StringBuilder, s : java.lang.String) : StringBuilder |
def
|
sequenceToXML (children : Seq[Node], pscope : NamespaceBinding, sb : StringBuilder, stripComment : Boolean) : Unit |
def
|
sort
(md : MetaData) : MetaData
returns a sorted attribute list
|
def
|
sort
(n : Node) : Node
returns the node with its attribute list sorted alphabetically (prefixes are ignored)
|
def
|
systemLiteralToString (sb : StringBuilder, s : java.lang.String) : StringBuilder |
def
|
systemLiteralToString (s : java.lang.String) : java.lang.String |
def
|
toXML
(n : Node) : java.lang.String
Returs the string representation of an XML node, with comments stripped
the comments.
|
def
|
toXML
(n : Node, stripComment : Boolean) : java.lang.String
Return the string representation of a Node. uses namespace mapping from
defaultPrefixes(n). |
def
|
toXML
(x : Node, pscope : NamespaceBinding, sb : StringBuilder, stripComment : Boolean) : Unit
Appends a tree to the given stringbuffer within given namespace scope.
|
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 : java.lang.String, s : StringBuilder) : StringBuilder
Appends unescaped string to
s, amp becomes &
lt becomes < etc.. |
def
|
view (s : java.lang.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 |
| Method Details |
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)Attribute values and
Atom nodes that are not Text nodes are unaffected.
def
view(s : java.lang.String) : Text
final
def
escape(text : java.lang.String) : java.lang.String
text - ...final
def
escape(text : java.lang.String, s : StringBuilder) : StringBuilder
s.text - ...s - ...final
def
unescape(ref : java.lang.String, s : StringBuilder) : StringBuilder
s, amp becomes &
lt becomes < etc..ref - ...s - ...null if ref was not a predefined entity.
def
collectNamespaces(nodes : Seq[Node]) : Set[java.lang.String]
nodes - ...
def
collectNamespaces(n : Node, set : Set[java.lang.String]) : Unit
n - ...set - ...
def
toXML(n : Node) : java.lang.String
n - the XML noden.
def
toXML(n : Node, stripComment : Boolean) : java.lang.String
defaultPrefixes(n).n - the XML nodestripComment - ...
def
toXML(x : Node, pscope : NamespaceBinding, sb : StringBuilder, stripComment : Boolean) : Unit
n - the nodepscope - the parent scopesb - stringbuffer to append tostripComment - if true, strip comments
def
sequenceToXML(children : Seq[Node], pscope : NamespaceBinding, sb : StringBuilder, stripComment : Boolean) : Unit
children - ...pscope - ...sb - ...stripComment - ...final
def
prefix(name : java.lang.String) : Option[java.lang.String]
name - ...
def
hashCode(pre : java.lang.String, label : java.lang.String, attribHashCode : Int, scpeHash : Int, children : Seq[Node]) : Int
uri - label - attribHashCode - children -
def
systemLiteralToString(s : java.lang.String) : java.lang.String
s - ...
def
systemLiteralToString(sb : StringBuilder, s : java.lang.String) : StringBuilder
sb - ...s - ...
def
publicLiteralToString(s : java.lang.String) : java.lang.String
s - ...
def
publicLiteralToString(sb : StringBuilder, s : java.lang.String) : StringBuilder
sb - ...s - ...
def
appendQuoted(s : java.lang.String) : java.lang.String
def
appendQuoted(s : java.lang.String, sb : StringBuilder) : StringBuilder
s does not contain ",
's' otherwise.s - ...sb - ...
def
appendEscapedQuoted(s : java.lang.String, sb : StringBuilder) : StringBuilder
s - ...sb - ...
def
getName(s : java.lang.String, index : Int) : java.lang.String
s - ...index - ...
def
checkAttributeValue(value : java.lang.String) : java.lang.String
null if the value is a correct attribute value,
error message if it isn't.value - ...
def
parseAttributeValue(value : java.lang.String) : Seq[Node]
value - ...
def
parseCharRef(ch : () => Char, nextch : () => Unit, reportSyntaxError : (java.lang.String) => Unit) : java.lang.String
CharRef ::= "&#" '0'..'9' {'0'..'9'} ";"
| "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";"
see [66]
ch - ...nextch - ...reportSyntaxError - ...|
Scala Library
|
|