diff options
author | Burak Emir <emir@epfl.ch> | 2006-03-25 18:19:48 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2006-03-25 18:19:48 +0000 |
commit | 9f7ee056ca469fabff580e90d4c8d265233adb28 (patch) | |
tree | 1b0c78a020d532aba22b07ff57d623a0a9167ec9 | |
parent | 5d8738edb4bc66bd473708738df27d4c68f98538 (diff) | |
download | scala-9f7ee056ca469fabff580e90d4c8d265233adb28.tar.gz scala-9f7ee056ca469fabff580e90d4c8d265233adb28.tar.bz2 scala-9f7ee056ca469fabff580e90d4c8d265233adb28.zip |
consolidated constants in object XML
-rw-r--r-- | src/library/scala/xml/TopScope.scala | 8 | ||||
-rw-r--r-- | src/library/scala/xml/XML.scala | 3 | ||||
-rw-r--r-- | src/library/scala/xml/parsing/FactoryAdapter.scala | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/library/scala/xml/TopScope.scala b/src/library/scala/xml/TopScope.scala index 5d0bdda5d7..7d22211cf2 100644 --- a/src/library/scala/xml/TopScope.scala +++ b/src/library/scala/xml/TopScope.scala @@ -7,23 +7,23 @@ \* */ // $Id$ - - package scala.xml; +import Predef._ + /** top level namespace scope. only contains the predefined binding * for the "xml" prefix which is bound to * "http://www.w3.org/XML/1998/namespace" */ case object TopScope extends NamespaceBinding(null, null, null) { - override def getURI(prefix1: String) = + override def getURI(prefix1: String): String = if(prefix1 == XML.prefix) XML.namespace; else null; - override def getPrefix(uri1: String) = + override def getPrefix(uri1: String): String = if(uri1 == XML.namespace) XML.prefix; else diff --git a/src/library/scala/xml/XML.scala b/src/library/scala/xml/XML.scala index fa46392a11..84491843c8 100644 --- a/src/library/scala/xml/XML.scala +++ b/src/library/scala/xml/XML.scala @@ -11,7 +11,7 @@ package scala.xml; - +import Predef._ import scala.xml.parsing.NoBindingFactoryAdapter ; import org.xml.sax.InputSource; @@ -21,6 +21,7 @@ import org.xml.sax.InputSource; object XML { val prefix = "xml" + val xmlns = "xmlns" val namespace = "http://www.w3.org/XML/1998/namespace" val preserve = "preserve"; val space = "space"; diff --git a/src/library/scala/xml/parsing/FactoryAdapter.scala b/src/library/scala/xml/parsing/FactoryAdapter.scala index ad24a8ab9a..d98f13eec5 100644 --- a/src/library/scala/xml/parsing/FactoryAdapter.scala +++ b/src/library/scala/xml/parsing/FactoryAdapter.scala @@ -143,14 +143,14 @@ abstract class FactoryAdapter extends DefaultHandler() { if(-1 != colon) { // prefixed attribute val pre = qname.substring(0, colon); val key = qname.substring(colon+1, qname.length()); - if("xmlns" == pre) + if(XML.xmlns == pre) scpe = value.length() match { case 0 => new NamespaceBinding(key, null, scpe); case _ => new NamespaceBinding(key, value, scpe); } else - m = new PrefixedAttribute(pre, key, value, m) - } else if("xmlns" == qname) + m = new PrefixedAttribute(pre, key, value, m); + } else if(XML.xmlns == qname) scpe = value.length() match { case 0 => new NamespaceBinding(null, null, scpe); case _ => new NamespaceBinding(null, value, scpe); |