summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2005-11-25 09:17:18 +0000
committerBurak Emir <emir@epfl.ch>2005-11-25 09:17:18 +0000
commit61befc9bdea2fe934391ce004e0432db8c93dce3 (patch)
treefba1bb47a28903fb90d7822c8841045cef6082f2 /sources
parent3a863546b115fa7157e5a86ee4767b4b5065e28d (diff)
downloadscala-61befc9bdea2fe934391ce004e0432db8c93dce3.tar.gz
scala-61befc9bdea2fe934391ce004e0432db8c93dce3.tar.bz2
scala-61befc9bdea2fe934391ce004e0432db8c93dce3.zip
verifying attributes
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 &lt;)
+ 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 &lt;)
+ 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);