File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -26,20 +26,25 @@ package scala.xml
26
26
class NodeBuffer extends scala.collection.mutable.ArrayBuffer [Node ] {
27
27
28
28
/**
29
- * Append a single node to this buffer, returns reference on this
30
- * NodeBuffer for convenience.
29
+ * Append given object to this buffer, returns reference on this NodeBuffer
30
+ * for convenience. Some rules apply: If o is null, it is ignored. If it is
31
+ * an Iterator or Iterable, its elements will be added. If o is a node, it is
32
+ * added as it is. If it is anything else, it gets wrapped in an Atom.
31
33
*
32
- * Append an iterable object to this buffer, returns reference on
33
- * this NodeBuffer for convenience.
34
34
*
35
- * Append given string as a <code>scala.xml.Text</code> node to this
36
- * buffer, returns reference on this NodeBuffer for convenience.
37
- *
38
- * @param o ...
39
- * @return ...
35
+ * @param o converts to an xml node and adds to this node buffer
36
+ * @return this nodebuffer
40
37
*/
41
38
def &+ (o : Any ): NodeBuffer = {
42
39
o match {
40
+ case null => // ignore null
41
+
42
+ case _:Unit =>
43
+ // ignore
44
+ case it: Iterator [_] =>
45
+ while (it.hasNext) {
46
+ this &+ it.next
47
+ }
43
48
case n: Node =>
44
49
super .+ (n)
45
50
case ns: Iterable [_] =>
@@ -55,10 +60,5 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] {
55
60
}
56
61
this
57
62
}
58
- /*
59
- def +(o: AnyVal): NodeBuffer = {
60
- super.+(Text(o.toString()));
61
- this
62
- }
63
- */
63
+
64
64
}
You can’t perform that action at this time.
0 commit comments