9
9
package scala
10
10
package xml
11
11
12
- /** This singleton object contains the `apply` and `unapplySeq` methods for
12
+ /**
13
+ * This singleton object contains the `apply` and `unapplySeq` methods for
13
14
* convenient construction and deconstruction. It is possible to deconstruct
14
15
* any `Node` instance (that is not a `SpecialNode` or a `Group`) using the
15
16
* syntax `case Elem(prefix, label, attribs, scope, child @ _*) => ...`
@@ -18,7 +19,8 @@ package xml
18
19
* @author Burak Emir <[email protected] >
19
20
*/
20
21
object Elem {
21
- /** Build an Elem, setting its minimizeEmpty property to `true` if it has no children. Note that this
22
+ /**
23
+ * Build an Elem, setting its minimizeEmpty property to `true` if it has no children. Note that this
22
24
* default may not be exactly what you want, as some XML dialects don't permit some elements to be minimized.
23
25
*
24
26
* @deprecated This factory method is retained for backward compatibility; please use the other one, with which you
@@ -32,35 +34,37 @@ object Elem {
32
34
new Elem (prefix, label, attributes, scope, minimizeEmpty, child : _* )
33
35
34
36
def unapplySeq (n : Node ) = n match {
35
- case _ : SpecialNode | _ : Group => None
36
- case _ => Some ((n.prefix, n.label, n.attributes, n.scope, n.child))
37
+ case _ : SpecialNode | _ : Group => None
38
+ case _ => Some ((n.prefix, n.label, n.attributes, n.scope, n.child))
37
39
}
38
40
39
41
import scala .sys .process ._
40
- /** Implicitly convert a [[scala.xml.Elem ]] into a
41
- * [[scala.sys.process.ProcessBuilder ]]. This is done by obtaining the text
42
- * elements of the element, trimming spaces, and then converting the result
43
- * from string to a process. Importantly, tags are completely ignored, so
44
- * they cannot be used to separate parameters.
45
- */
42
+ /**
43
+ * Implicitly convert a [[scala.xml.Elem ]] into a
44
+ * [[scala.sys.process.ProcessBuilder ]]. This is done by obtaining the text
45
+ * elements of the element, trimming spaces, and then converting the result
46
+ * from string to a process. Importantly, tags are completely ignored, so
47
+ * they cannot be used to separate parameters.
48
+ */
46
49
@ deprecated(" To create a scala.sys.process.Process from an xml.Elem, please use Process(elem.text.trim)." , " 2.11.0" )
47
50
implicit def xmlToProcess (command : scala.xml.Elem ): ProcessBuilder = Process (command.text.trim)
48
51
49
52
@ deprecated(" To create a scala.sys.process.Process from an xml.Elem, please use Process(elem.text.trim)." , " 2.11.0" )
50
53
implicit def processXml (p : Process .type ) = new {
51
- /** Creates a [[scala.sys.process.ProcessBuilder ]] from a Scala XML Element.
52
- * This can be used as a way to template strings.
53
- *
54
- * @example {{{
55
- * apply(<x> {dxPath.absolutePath} --dex --output={classesDexPath.absolutePath} {classesMinJarPath.absolutePath}</x>)
56
- * }}}
57
- */
54
+ /**
55
+ * Creates a [[scala.sys.process.ProcessBuilder ]] from a Scala XML Element.
56
+ * This can be used as a way to template strings.
57
+ *
58
+ * @example {{{
59
+ * apply(<x> {dxPath.absolutePath} --dex --output={classesDexPath.absolutePath} {classesMinJarPath.absolutePath}</x>)
60
+ * }}}
61
+ */
58
62
def apply (command : Elem ): ProcessBuilder = Process (command.text.trim)
59
63
}
60
64
}
61
65
62
-
63
- /* * The case class `Elem` extends the `Node` class,
66
+ /**
67
+ * The case class `Elem` extends the `Node` class,
64
68
* providing an immutable data object representing an XML element.
65
69
*
66
70
* @param prefix namespace prefix (may be null, but not the empty string)
@@ -81,15 +85,14 @@ class Elem(
81
85
override val scope : NamespaceBinding ,
82
86
val minimizeEmpty : Boolean ,
83
87
val child : Node * )
84
- extends Node with Serializable
85
- {
88
+ extends Node with Serializable {
86
89
@ deprecated(" This constructor is retained for backward compatibility. Please use the primary constructor, which lets you specify your own preference for `minimizeEmpty`." , " 2.10.0" )
87
90
def this (prefix : String , label : String , attributes : MetaData , scope : NamespaceBinding , child : Node * ) = {
88
91
this (prefix, label, attributes, scope, child.isEmpty, child : _* )
89
92
}
90
93
91
94
final override def doCollectNamespaces = true
92
- final override def doTransform = true
95
+ final override def doTransform = true
93
96
94
97
override val attributes = MetaData .normalize(attributes1, scope)
95
98
@@ -106,7 +109,8 @@ extends Node with Serializable
106
109
override protected def basisForHashCode : Seq [Any ] =
107
110
prefix :: label :: attributes :: child.toList
108
111
109
- /** Returns a new element with updated attributes, resolving namespace uris
112
+ /**
113
+ * Returns a new element with updated attributes, resolving namespace uris
110
114
* from this element's scope. See MetaData.update for details.
111
115
*
112
116
* @param updates MetaData with new and updated attributes
@@ -115,7 +119,8 @@ extends Node with Serializable
115
119
final def % (updates : MetaData ): Elem =
116
120
copy(attributes = MetaData .update(attributes, scope, updates))
117
121
118
- /** Returns a copy of this element with any supplied arguments replacing
122
+ /**
123
+ * Returns a copy of this element with any supplied arguments replacing
119
124
* this element's value for that field.
120
125
*
121
126
* @return a new symbol with updated attributes
@@ -126,10 +131,10 @@ extends Node with Serializable
126
131
attributes : MetaData = this .attributes,
127
132
scope : NamespaceBinding = this .scope,
128
133
minimizeEmpty : Boolean = this .minimizeEmpty,
129
- child : Seq [Node ] = this .child.toSeq
130
- ): Elem = Elem (prefix, label, attributes, scope, minimizeEmpty, child : _* )
134
+ child : Seq [Node ] = this .child.toSeq): Elem = Elem (prefix, label, attributes, scope, minimizeEmpty, child : _* )
131
135
132
- /** Returns concatenation of `text(n)` for each child `n`.
136
+ /**
137
+ * Returns concatenation of `text(n)` for each child `n`.
133
138
*/
134
139
override def text = (child map (_.text)).mkString
135
140
}
0 commit comments