diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-12 13:23:18 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-12 13:23:18 -0800 |
commit | ceeccd832a12eae7400852303112c4a0ee34ae11 (patch) | |
tree | 55acf8be9110708c545f6c981ca29033d3c8d7a0 /src | |
parent | 1c5a7f019d7d4abb7310bfc93cdd59db7dda1d72 (diff) | |
parent | 25da86a228a3ae7aecaacdfd094812d53209aece (diff) | |
download | scala-ceeccd832a12eae7400852303112c4a0ee34ae11.tar.gz scala-ceeccd832a12eae7400852303112c4a0ee34ae11.tar.bz2 scala-ceeccd832a12eae7400852303112c4a0ee34ae11.zip |
Merge remote-tracking branch 'szabolcsberecz/xml-attribute-fixes' into develop
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/xml/PrefixedAttribute.scala | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/library/scala/xml/PrefixedAttribute.scala b/src/library/scala/xml/PrefixedAttribute.scala index 436dfcda43..b80d6a1c73 100644 --- a/src/library/scala/xml/PrefixedAttribute.scala +++ b/src/library/scala/xml/PrefixedAttribute.scala @@ -13,22 +13,25 @@ package scala.xml * * @param pre ... * @param key ... - * @param value the attribute value, which may not be null + * @param value the attribute value * @param next ... */ class PrefixedAttribute( val pre: String, val key: String, val value: Seq[Node], - val next: MetaData) + val next1: MetaData) extends Attribute { - if (value eq null) - throw new UnsupportedOperationException("value is null") + val next = if (value ne null) next1 else next1.remove(key) - /** same as this(key, Utility.parseAttributeValue(value), next) */ + /** same as this(pre, key, Text(value), next), or no attribute if value is null */ def this(pre: String, key: String, value: String, next: MetaData) = - this(pre, key, Text(value), next) + this(pre, key, if (value ne null) Text(value) else null: NodeSeq, next) + + /** same as this(pre, key, value.get, next), or no attribute if value is None */ + def this(pre: String, key: String, value: Option[Seq[Node]], next: MetaData) = + this(pre, key, value.orNull, next) /** Returns a copy of this unprefixed attribute with the given * next field. |