diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-14 10:25:09 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2012-12-14 10:25:09 -0800 |
commit | 22ed6d493b676e28c324d77a1e31f39672f2a9e1 (patch) | |
tree | 8b368e64d8f07552e64adb5a917a704c2a598caf /src | |
parent | 89decde4272c1428f884fd4c4d293cb6a8c7af13 (diff) | |
parent | 1426d9cecf1b6123d0dffe44a8ab0dbf88a29707 (diff) | |
download | scala-22ed6d493b676e28c324d77a1e31f39672f2a9e1.tar.gz scala-22ed6d493b676e28c324d77a1e31f39672f2a9e1.tar.bz2 scala-22ed6d493b676e28c324d77a1e31f39672f2a9e1.zip |
Merge pull request #1679 from rtyley/nodeseq-attribute-operator
Add convenience attribute operator to NodeSeq
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/xml/NodeSeq.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/library/scala/xml/NodeSeq.scala b/src/library/scala/xml/NodeSeq.scala index decf60dad7..d2efc947b1 100644 --- a/src/library/scala/xml/NodeSeq.scala +++ b/src/library/scala/xml/NodeSeq.scala @@ -145,6 +145,11 @@ abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with S } } + /** Convenience method which returns string text of the named attribute. Use: + * - `that \@ "foo"` to get the string text of attribute `"foo"`; + */ + def \@(attributeName: String): String = (this \ ("@" + attributeName)).text + override def toString(): String = theSeq.mkString def text: String = (this map (_.text)).mkString |