blob: c5f79111388721a5277ec6f2f41608c23f56d7a6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.xml
import compat.StringBuilder
/** A hack to group XML nodes in one node for output.
*
* @author Burak Emir
* @version 1.0
*/
[serializable]
case class Group(val nodes: Seq[Node]) extends Node {
override def theSeq = nodes
/** structural equality */
override def equals(x: Any) = x match {
case z:Node => (length == 1) && z == apply(0)
case z:Seq[Node] => sameElements(z)
case z:String => text == z
case _ => false;
}
/**
* @throws UnsupportedOperationException (always)
*/
final def label =
throw new UnsupportedOperationException("class Group does not support method 'label'")
/**
* @throws UnsupportedOperationException (always)
*/
final override def attributes =
throw new UnsupportedOperationException("class Group does not support method 'attributes'")
/**
* @throws UnsupportedOperationException (always)
*/
final override def namespace =
throw new UnsupportedOperationException("class Group does not support method 'namespace'")
/**
* @throws UnsupportedOperationException (always)
*/
final override def child =
throw new UnsupportedOperationException("class Group does not support method 'child'")
/**
* @throws UnsupportedOperationException (always)
*/
def toString(sb: StringBuilder) =
throw new UnsupportedOperationException("class Group does not support method toString(StringBuilder)")
override def text = { // same impl as NodeSeq
val sb = new StringBuilder()
val it = elements
while (it.hasNext)
sb.append(it.next.text)
sb.toString()
}
}
|