summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2004-03-11 13:49:38 +0000
committerburaq <buraq@epfl.ch>2004-03-11 13:49:38 +0000
commit952ee03cca851166daa6418aae2f0ee23a27d28f (patch)
tree3028ef9e2a490f1edf9ae1465f5c073bbd5d017a /sources
parentd95cab4184fb13970440abec5a5b346c8c67944f (diff)
downloadscala-952ee03cca851166daa6418aae2f0ee23a27d28f.tar.gz
scala-952ee03cca851166daa6418aae2f0ee23a27d28f.tar.bz2
scala-952ee03cca851166daa6418aae2f0ee23a27d28f.zip
changed Symbol to Elem
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala16
-rw-r--r--sources/scala/xml/nobinding/XML.scala4
2 files changed, 11 insertions, 9 deletions
diff --git a/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala b/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala
index 17bf4be118..7f841043d8 100644
--- a/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala
+++ b/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala
@@ -10,7 +10,7 @@ package scala.xml.nobinding;
import scala.collection.mutable.HashMap ;
import scala.collection.immutable.ListMap ;
-import scala.xml.{Node,Text,FactoryAdapter,Utility} ;
+import scala.xml.{Elem, Node,Text,FactoryAdapter,Utility} ;
import org.xml.sax.InputSource;
/** nobinding adaptor providing callbacks to parser to create elements.
@@ -18,6 +18,8 @@ import org.xml.sax.InputSource;
*/
class NoBindingFactoryAdapter extends FactoryAdapter {
+ type Elem = scala.xml.Elem;
+
// FactoryAdpater methods
/** returns true. Every XML node may contain text that the application needs
@@ -25,11 +27,11 @@ class NoBindingFactoryAdapter extends FactoryAdapter {
def nodeContainsText( label:java.lang.String ):boolean = true;
/* default behaviour is to use hash-consing */
- val cache = new HashMap[int,Symbol]();
+ val cache = new HashMap[int,Elem]();
/** creates a node. never creates the same node twice, using hash-consing
*/
- def createNode( label: String, attrs: HashMap[String,String], children: List[Node] ):Symbol = {
+ def createNode( label: String, attrs: HashMap[String,String], children: List[Node] ):Elem = {
val elHashCode = Utility.hashCode( label, attrs, children ) ;
@@ -40,12 +42,12 @@ class NoBindingFactoryAdapter extends FactoryAdapter {
//System.err.println("[using cached elem +"+cachedElem.toXML+"!]");
cachedElem
case None => val el = if( children.isEmpty ) {
- new Symbol( label ) {
+ new Elem( label ) {
override def attributes = ListMap.Empty[String,String].incl( attrList );
override def hashCode() = Utility.hashCode( label, attrList.hashCode(), children );
};
} else {
- new Symbol( label, children:_* ) {
+ new Elem( label, children:_* ) {
override def attributes = ListMap.Empty[String,String].incl( attrList );
override def hashCode() = Utility.hashCode( label, attrList.hashCode(), children );
};
@@ -61,6 +63,6 @@ class NoBindingFactoryAdapter extends FactoryAdapter {
/** loads an XML document, returning a Symbol node.
*/
- override def loadXML( source:InputSource ):Symbol =
- super.loadXML( source ).asInstanceOf[ Symbol ]
+ override def loadXML( source:InputSource ):Elem =
+ super.loadXML( source ).asInstanceOf[ Elem ]
}
diff --git a/sources/scala/xml/nobinding/XML.scala b/sources/scala/xml/nobinding/XML.scala
index e5cdf741cb..8a992a4874 100644
--- a/sources/scala/xml/nobinding/XML.scala
+++ b/sources/scala/xml/nobinding/XML.scala
@@ -23,11 +23,11 @@ object XML {
// functions for generic xml loading, saving
/** loads XML from a given file*/
- def load( source:InputSource ):Symbol =
+ def load( source:InputSource ):scala.xml.Elem =
new NoBindingFactoryAdapter().loadXML( source );
/** saves XML to filename with encoding ISO-8859-1 */
- def save( filename:String, doc:Symbol ):Unit = {
+ def save( filename:String, doc:Elem ):Unit = {
/* using NIO classes of JDK 1.4 */
import java.io.{FileOutputStream,Writer};
import java.nio.channels.{Channels,FileChannel};