summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2008-03-27 05:07:03 +0000
committerBurak Emir <emir@epfl.ch>2008-03-27 05:07:03 +0000
commit54f611edb31c867a46a2df4d83df7068358ea39e (patch)
treebfd01e22635ae62923ae3f0095f090491e484ded /src
parentef488e9e397a045afe5ad6d2c2a4c6b4e8b1cdfa (diff)
downloadscala-54f611edb31c867a46a2df4d83df7068358ea39e.tar.gz
scala-54f611edb31c867a46a2df4d83df7068358ea39e.tar.bz2
scala-54f611edb31c867a46a2df4d83df7068358ea39e.zip
reverted parseattrubtevalue hack, fixed attribu...
reverted parseattrubtevalue hack, fixed attribute value parsing
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/xml/PrefixedAttribute.scala2
-rw-r--r--src/library/scala/xml/UnprefixedAttribute.scala4
-rw-r--r--src/library/scala/xml/parsing/FactoryAdapter.scala4
-rw-r--r--src/library/scala/xml/parsing/MarkupParser.scala17
4 files changed, 14 insertions, 13 deletions
diff --git a/src/library/scala/xml/PrefixedAttribute.scala b/src/library/scala/xml/PrefixedAttribute.scala
index 0ee62b9cd7..78b28b17b1 100644
--- a/src/library/scala/xml/PrefixedAttribute.scala
+++ b/src/library/scala/xml/PrefixedAttribute.scala
@@ -28,7 +28,7 @@ class PrefixedAttribute(val pre: String,
/** same as this(key, Utility.parseAttributeValue(value), next) */
def this(pre: String, key: String, value: String, next: MetaData) =
- this(pre, key, Utility.parseAttributeValue(value), next)
+ this(pre, key, Text(value), next)
/*
// the problem here is the fact that we cannot remove the proper attribute from
diff --git a/src/library/scala/xml/UnprefixedAttribute.scala b/src/library/scala/xml/UnprefixedAttribute.scala
index adaca90d97..e9f5dff0c5 100644
--- a/src/library/scala/xml/UnprefixedAttribute.scala
+++ b/src/library/scala/xml/UnprefixedAttribute.scala
@@ -19,9 +19,9 @@ class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData
val next = if (value ne null) next1 else next1.remove(key)
- /** same as this(key, Utility.parseAttributeValue(value), next) */
+ /** same as this(key, Text(value), next) */
def this(key: String, value: String, next: MetaData) =
- this(key, if (value ne null) Utility.parseAttributeValue(value) else {val z:NodeSeq=null;z}, next)
+ this(key, if (value ne null) Text(value) else {val z:NodeSeq=null;z}, next)
/** same as this(key, value.get, next), or no attribute if value is None */
def this(key: String, value: Option[Seq[Node]], next: MetaData) =
diff --git a/src/library/scala/xml/parsing/FactoryAdapter.scala b/src/library/scala/xml/parsing/FactoryAdapter.scala
index 2ca0527a6b..4b8ca9f9cc 100644
--- a/src/library/scala/xml/parsing/FactoryAdapter.scala
+++ b/src/library/scala/xml/parsing/FactoryAdapter.scala
@@ -145,14 +145,14 @@ abstract class FactoryAdapter extends DefaultHandler() {
case _ => new NamespaceBinding(key, value, scpe)
}
else
- m = new PrefixedAttribute(pre, key, value, m)
+ m = new PrefixedAttribute(pre, key, Text(value), m)
} else if ("xmlns" /*XML.xmlns*/ == qname)
scpe = value.length() match {
case 0 => new NamespaceBinding(null, null, scpe)
case _ => new NamespaceBinding(null, value, scpe)
}
else
- m = new UnprefixedAttribute(qname, value, m)
+ m = new UnprefixedAttribute(qname, Text(value), m)
}
scopeStack.push(scpe)
attribStack.push(m)
diff --git a/src/library/scala/xml/parsing/MarkupParser.scala b/src/library/scala/xml/parsing/MarkupParser.scala
index b8f15162c7..541cc65ac2 100644
--- a/src/library/scala/xml/parsing/MarkupParser.scala
+++ b/src/library/scala/xml/parsing/MarkupParser.scala
@@ -294,13 +294,13 @@ trait MarkupParser extends AnyRef with TokenTests { self: MarkupParser with Mar
case Some(prefix) =>
val key = qname.substring(prefix.length+1, qname.length);
- aMap = new PrefixedAttribute(prefix, key, value, aMap);
+ aMap = new PrefixedAttribute(prefix, key, Text(value), aMap);
case _ =>
if( qname == "xmlns" )
scope = new NamespaceBinding(null, value, scope);
else
- aMap = new UnprefixedAttribute(qname, value, aMap);
+ aMap = new UnprefixedAttribute(qname, Text(value), aMap);
}
if ((ch != '/') && (ch != '>') && ('?' != ch))
@@ -1174,7 +1174,7 @@ trait MarkupParser extends AnyRef with TokenTests { self: MarkupParser with Mar
def normalizeAttributeValue(attval: String): String = {
val s: Seq[Char] = attval
val it = s.elements
- while(it.hasNext) {
+ while (it.hasNext) {
it.next match {
case ' '|'\t'|'\n'|'\r' =>
cbuf.append(' ');
@@ -1191,12 +1191,13 @@ trait MarkupParser extends AnyRef with TokenTests { self: MarkupParser with Mar
d = it.next
} while(d != ';');
nbuf.toString() match {
- //case "lt" => cbuf.append('<')
- //case "gt" => cbuf.append('>')
- //case "amp" => cbuf.append('&')
- //case "quote" => cbuf.append('"')
+ case "lt" => cbuf.append('<')
+ case "gt" => cbuf.append('>')
+ case "amp" => cbuf.append('&')
+ case "apos" => cbuf.append('\'')
+ case "quot" => cbuf.append('"')
+ case "quote" => cbuf.append('"')
case name =>
- //don't handle entityrefs for now
cbuf.append('&')
cbuf.append(name)
cbuf.append(';')