summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/xml/MalformedAttributeException.scala3
-rw-r--r--sources/scala/xml/PrefixedAttribute.scala6
-rw-r--r--sources/scala/xml/UnprefixedAttribute.scala6
3 files changed, 15 insertions, 0 deletions
diff --git a/sources/scala/xml/MalformedAttributeException.scala b/sources/scala/xml/MalformedAttributeException.scala
new file mode 100644
index 0000000000..bcb4c0f393
--- /dev/null
+++ b/sources/scala/xml/MalformedAttributeException.scala
@@ -0,0 +1,3 @@
+package scala.xml;
+
+case class MalformedAttributeException(msg:String) extends java.lang.RuntimeException(msg);
diff --git a/sources/scala/xml/PrefixedAttribute.scala b/sources/scala/xml/PrefixedAttribute.scala
index 9ceecc45ff..38fb907a24 100644
--- a/sources/scala/xml/PrefixedAttribute.scala
+++ b/sources/scala/xml/PrefixedAttribute.scala
@@ -17,6 +17,12 @@ class PrefixedAttribute(val pre: String,
val value: String,
val next: MetaData) extends MetaData {
+ // verify that value is a proper attribute value (references, no <)
+ Utility.checkAttributeValue(value) match {
+ case null => ;
+ case msg => throw new MalformedAttributeException(msg);
+ }
+
/** Returns a copy of this unprefixed attribute with the given
* next field.
*/
diff --git a/sources/scala/xml/UnprefixedAttribute.scala b/sources/scala/xml/UnprefixedAttribute.scala
index b00b25f31c..82d30ac804 100644
--- a/sources/scala/xml/UnprefixedAttribute.scala
+++ b/sources/scala/xml/UnprefixedAttribute.scala
@@ -14,6 +14,12 @@ package scala.xml;
*/
class UnprefixedAttribute(val key: String, val value: String, val next: MetaData) extends MetaData {
+ // verify that value is a proper attribute value (references, no <)
+ Utility.checkAttributeValue(value) match {
+ case null => ;
+ case msg => throw new MalformedAttributeException(msg);
+ }
+
/** returns a copy of this unprefixed attribute with the given next field*/
def copy(next: MetaData) =
new UnprefixedAttribute(key, value, next);