diff options
author | Burak Emir <emir@epfl.ch> | 2008-01-28 22:27:56 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2008-01-28 22:27:56 +0000 |
commit | 9d7b414f6cbb16d87fefb96e28d4c07afde7c65b (patch) | |
tree | 594f4e159aa0bb4096c9441d649a52df48dd9bd3 /src/library | |
parent | fc0948748007901204e63f704c9d52a16464f109 (diff) | |
download | scala-9d7b414f6cbb16d87fefb96e28d4c07afde7c65b.tar.gz scala-9d7b414f6cbb16d87fefb96e28d4c07afde7c65b.tar.bz2 scala-9d7b414f6cbb16d87fefb96e28d4c07afde7c65b.zip |
support for <elem key={x:Option[Seq[Node]]} />,...
support for <elem key={x:Option[Seq[Node]]} />, so that Options can be used for optional attributes.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/xml/UnprefixedAttribute.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/library/scala/xml/UnprefixedAttribute.scala b/src/library/scala/xml/UnprefixedAttribute.scala index e8790620de..611eba2ac6 100644 --- a/src/library/scala/xml/UnprefixedAttribute.scala +++ b/src/library/scala/xml/UnprefixedAttribute.scala @@ -19,9 +19,13 @@ class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData val next = if (value ne null) next1 else next1.remove(key) - /** same as this(key, Utility.parseAttributeValue(value), next) */ + /** same as this(key, Text(value), next) */ def this(key: String, value: String, next: MetaData) = - this(key, if(value ne null) Text(value) else {val z:NodeSeq=null;z}, next) + this(key, if (value ne null) Text(value) else {val z:NodeSeq=null;z}, next) + + /** same as this(key, Text(value), next) */ + def this(key: String, value: Option[Seq[Node]], next: MetaData) = + this(key, if (!value.isEmpty) value.get else {val z:NodeSeq=null;z}, next) /** returns a copy of this unprefixed attribute with the given next field*/ def copy(next: MetaData) = |