diff options
author | Burak Emir <emir@epfl.ch> | 2005-11-25 09:17:18 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2005-11-25 09:17:18 +0000 |
commit | 61befc9bdea2fe934391ce004e0432db8c93dce3 (patch) | |
tree | fba1bb47a28903fb90d7822c8841045cef6082f2 | |
parent | 3a863546b115fa7157e5a86ee4767b4b5065e28d (diff) | |
download | scala-61befc9bdea2fe934391ce004e0432db8c93dce3.tar.gz scala-61befc9bdea2fe934391ce004e0432db8c93dce3.tar.bz2 scala-61befc9bdea2fe934391ce004e0432db8c93dce3.zip |
verifying attributes
-rw-r--r-- | config/list/library.lst | 5 | ||||
-rw-r--r-- | sources/scala/xml/MalformedAttributeException.scala | 3 | ||||
-rw-r--r-- | sources/scala/xml/PrefixedAttribute.scala | 6 | ||||
-rw-r--r-- | sources/scala/xml/UnprefixedAttribute.scala | 6 |
4 files changed, 20 insertions, 0 deletions
diff --git a/config/list/library.lst b/config/list/library.lst index 42dae1a24c..cfe1d974e7 100644 --- a/config/list/library.lst +++ b/config/list/library.lst @@ -335,6 +335,7 @@ xml/Comment.scala xml/Document.scala xml/Elem.scala xml/EntityRef.scala +xml/MalformedAttributeException.scala xml/MetaData.scala xml/Molecule.scala xml/NamespaceBinding.scala @@ -391,4 +392,8 @@ xml/transform/BasicTransformer.scala xml/transform/RewriteRule.scala xml/transform/RuleTransformer.scala +#xml/xsd/Decl.scala +#xml/xsd/ContentModel.scala +#xml/xsd/XsTypeSymbol.scala + ############################################################################## 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); |