summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSzabolcs Berecz <szabolcs.berecz@gmail.com>2012-01-12 21:48:02 +0100
committerSzabolcs Berecz <szabolcs.berecz@gmail.com>2012-01-12 21:48:02 +0100
commit25da86a228a3ae7aecaacdfd094812d53209aece (patch)
tree87e549fe01f964e80c56a3ff5331eadfbe9091a5 /src
parentccb590c0378819011640a58b822fbdeb938144dc (diff)
downloadscala-25da86a228a3ae7aecaacdfd094812d53209aece.tar.gz
scala-25da86a228a3ae7aecaacdfd094812d53209aece.tar.bz2
scala-25da86a228a3ae7aecaacdfd094812d53209aece.zip
Cleanup after "Fixed equality and string representation of xml attributes with null value"
This commit reverts the following two commits: 5f2568e36b87d183fd4e4442d5c304db628846c4 - "Revert "Accept prefixed xml attributes with null value" b00002f9049c034510438881b4a4449d73fe2f54 - "Disabling some scaladoc tests." and fixes a scaladoc test broken by: 4787f883604d1344257c0b40c15790c3dde477f2 - "Fixed equality and string representation of xml attributes with null value"
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/xml/PrefixedAttribute.scala15
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.