summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2004-06-14 10:52:37 +0000
committerburaq <buraq@epfl.ch>2004-06-14 10:52:37 +0000
commita278f799614f22ddf3c2f035e0282120c2b8862d (patch)
treebe8f42538b7b7ec22a2e70b3a7e6ce595e317ef0
parente56821baaf295980ff236373879a7c48ecc35d6f (diff)
downloadscala-a278f799614f22ddf3c2f035e0282120c2b8862d.tar.gz
scala-a278f799614f22ddf3c2f035e0282120c2b8862d.tar.bz2
scala-a278f799614f22ddf3c2f035e0282120c2b8862d.zip
namespaces
-rw-r--r--config/list/library.lst2
-rw-r--r--sources/scala/tools/dtd2scala/DeclToScala.scala4
-rw-r--r--sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml5
-rw-r--r--sources/scala/tools/scalac/ast/parser/MarkupParser.scala5
-rw-r--r--sources/scala/xml/BindingFactoryAdapter.scala8
-rw-r--r--sources/scala/xml/CharData.scala3
-rw-r--r--sources/scala/xml/Comment.scala3
-rw-r--r--sources/scala/xml/Elem.scala20
-rw-r--r--sources/scala/xml/EntityRef.scala3
-rw-r--r--sources/scala/xml/FactoryAdapter.scala7
-rw-r--r--sources/scala/xml/Node.scala8
-rw-r--r--sources/scala/xml/ProcInstr.scala3
-rw-r--r--sources/scala/xml/Text.scala3
-rw-r--r--sources/scala/xml/Utility.scala8
-rw-r--r--sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala20
-rw-r--r--test/files/jvm/xmlLiterals.scala44
-rw-r--r--test/files/jvm/xmlstuff.scala109
17 files changed, 148 insertions, 107 deletions
diff --git a/config/list/library.lst b/config/list/library.lst
index 363632672e..c4b04db124 100644
--- a/config/list/library.lst
+++ b/config/list/library.lst
@@ -162,6 +162,8 @@ xml/Elem.scala
xml/ExternalID.scala
xml/EntityRef.scala
xml/FactoryAdapter.scala
+xml/Namespace.scala
+xml/NamespaceRegistry.scala
xml/Node.scala
xml/NodeBuffer.scala
xml/NodeSeq.scala
diff --git a/sources/scala/tools/dtd2scala/DeclToScala.scala b/sources/scala/tools/dtd2scala/DeclToScala.scala
index 2dfb924310..0fbb396dc5 100644
--- a/sources/scala/tools/dtd2scala/DeclToScala.scala
+++ b/sources/scala/tools/dtd2scala/DeclToScala.scala
@@ -23,7 +23,7 @@ class DeclToScala(fOut:PrintWriter,
moduleName:String,
elemMap:Map[ String, MyElemDecl ] ) {
- abstract class objectTemplate {
+ abstract class ObjectTemplate {
val objectName : String = "myXML"; /* DEFAULT MODULE NAME */
val package_ : String = "";
val compress : boolean = true;
@@ -240,7 +240,7 @@ class DeclToScala(fOut:PrintWriter,
/** runs translation. */
def run:Unit = {
- new objectTemplate {
+ new ObjectTemplate {
override val objectName = moduleName
}.write;
fOut.flush();
diff --git a/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml b/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml
index 63d1abf12f..68b0db8546 100644
--- a/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml
+++ b/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml
@@ -48,7 +48,10 @@
+ch.elements.map( x => x.label ).toList.mkString("",",","")
+"\n content model was "+cM);
- abstract class <string ref="objectName"/>Node$ extends scala.xml.Node;
+ abstract class <string ref="objectName"/>Node$ extends scala.xml.Node {
+ /** the namespace code of this node */
+ final val namespaceCode: Int = 0;
+ }
def tagIterator(ch:Seq[scala.xml.Node]):Iterator[Int] = new Iterator[Int] {
val it = ch.elements.buffered;
diff --git a/sources/scala/tools/scalac/ast/parser/MarkupParser.scala b/sources/scala/tools/scalac/ast/parser/MarkupParser.scala
index 9505475552..511387ed32 100644
--- a/sources/scala/tools/scalac/ast/parser/MarkupParser.scala
+++ b/sources/scala/tools/scalac/ast/parser/MarkupParser.scala
@@ -153,6 +153,7 @@ class MarkupParser( unit:Unit, s:Scanner, p:Parser, preserveWS:boolean ) {
def mkXML(pos:int, isPattern:boolean, t:Tree, args:Array[Tree]):Tree = {
if( isPattern ) {
val ts = new myTreeList();
+ ts.append( new Tree$Ident( Names.PATTERN_WILDCARD ) );
ts.append( t );
ts.append( new Tree$Ident( Names.PATTERN_WILDCARD ) );
ts.append( convertToText( true, args ) );
@@ -161,9 +162,9 @@ class MarkupParser( unit:Unit, s:Scanner, p:Parser, preserveWS:boolean ) {
ts.toArray())
} else {
val constrArgs = if( 0 == args.length ) {
- Predef.Array[Tree]( t, _emptyMap( pos ) )
+ Predef.Array[Tree]( gen.mkIntLit(pos, 0), t, _emptyMap( pos ) )
} else {
- Predef.Array[Tree]( t, _emptyMap( pos ), make.Typed(
+ Predef.Array[Tree]( gen.mkIntLit(pos, 0), t, _emptyMap( pos ), make.Typed(
pos, makeXMLseq(pos, args ), make.Ident(pos, TypeNames.WILDCARD_STAR)))
};
make.Apply( pos, _scala_xml_Elem( pos ), constrArgs )
diff --git a/sources/scala/xml/BindingFactoryAdapter.scala b/sources/scala/xml/BindingFactoryAdapter.scala
index d007427ac5..e3c1118a0f 100644
--- a/sources/scala/xml/BindingFactoryAdapter.scala
+++ b/sources/scala/xml/BindingFactoryAdapter.scala
@@ -39,9 +39,13 @@ abstract class BindingFactoryAdapter extends FactoryAdapter() {
//var cacheCount = 0;
/** creates an element. see also compress */
- def createNode(elemName:String,
+ def createNode(uri:String,
+ elemName:String,
attribs:HashMap[String,String],
children:List[Node] ):Node = {
+
+ val ncode = NamespaceRegistry.getCode( uri );
+
// 2do:optimize
if( !compress ) {
// get constructor
@@ -50,7 +54,7 @@ abstract class BindingFactoryAdapter extends FactoryAdapter() {
} else { // do hash-consing
val ahc = attribs.toList.hashCode();
- val h = Utility.hashCode( elemName, ahc, children );
+ val h = Utility.hashCode( ncode, elemName, ahc, children );
cache.get( h ).match {
case Some(cachedElem) =>
diff --git a/sources/scala/xml/CharData.scala b/sources/scala/xml/CharData.scala
index e929b4e41f..6b6d031fd4 100644
--- a/sources/scala/xml/CharData.scala
+++ b/sources/scala/xml/CharData.scala
@@ -27,6 +27,9 @@ case class CharData( text:String ) extends Node {
*/
def label = "#CDATA";
+ /** always 0 */
+ final val namespaceCode = 0;
+
/** always empty */
final def attribute = Node.NoAttributes;
diff --git a/sources/scala/xml/Comment.scala b/sources/scala/xml/Comment.scala
index 45665dcceb..65cecd66c9 100644
--- a/sources/scala/xml/Comment.scala
+++ b/sources/scala/xml/Comment.scala
@@ -32,6 +32,9 @@ case class Comment( text:String ) extends Node {
/** the constant "#REM" */
def label = "#REM";
+ /** always 0 */
+ final val namespaceCode = 0;
+
/** always empty */
final def attribute = Node.NoAttributes;
diff --git a/sources/scala/xml/Elem.scala b/sources/scala/xml/Elem.scala
index 8e68b242f8..c8885da5d9 100644
--- a/sources/scala/xml/Elem.scala
+++ b/sources/scala/xml/Elem.scala
@@ -14,14 +14,24 @@ import scala.collection.immutable;
/** The case class <code>Elem</code> implements the Node trait,
* providing an immutable data object representing an XML element.
*
+ * @param nsCode the namespace code as assigned by NamespaceRegistry
+ * @param label the element name
+ * @param attribute the attribute map
+ * @param child the children of this node
* @author Burak Emir
- * @version 1.0, 26/04/2004
*/
-case class Elem( label: String, attribute:immutable.Map[String,String], child: Node*) extends Node {
+case class Elem( nsCode:Int, label: String, attribute:immutable.Map[String,String], child: Node*) extends Node {
final override def typeTag$:Int = 0;
- def this(label: String, child: Node*) = this(label,immutable.ListMap.Empty[String,String],child:_*);
+ /** the namespace code of this node */
+ val namespaceCode: Int = nsCode;
+
+ def this(nsCode:Int, label: String, child: Node*) =
+ this(nsCode, label, Node.NoAttributes, child:_*);
+
+ def this(label: String, child: Node*) =
+ this(Node.EmptyNamespace, label, Node.NoAttributes, child:_*);
/** Return a new element with updated attributes
*
@@ -36,7 +46,7 @@ case class Elem( label: String, attribute:immutable.Map[String,String], child: N
for ( val p <- attrs ) {
newmap = newmap.update( p._1, p._2 )
}
- return Elem( label, newmap, child:_* )
+ Elem(nsCode, label, newmap, child:_*)
}
/** Return a new symbol with updated attribute
@@ -50,7 +60,7 @@ case class Elem( label: String, attribute:immutable.Map[String,String], child: N
newmap = newmap.update( p._1, p._2 )
}
newmap = newmap.update( attr._1, attr._2 );
- return Elem( label, newmap, child:_* )
+ Elem(nsCode, label, newmap, child:_*)
}
}
diff --git a/sources/scala/xml/EntityRef.scala b/sources/scala/xml/EntityRef.scala
index 7cbb2f29f5..acfbf3840f 100644
--- a/sources/scala/xml/EntityRef.scala
+++ b/sources/scala/xml/EntityRef.scala
@@ -24,6 +24,9 @@ case class EntityRef( entityName:String ) extends Node {
*/
def label = "#ENTITY";
+ /** always 0 */
+ final val namespaceCode = 0;
+
final override def equals(x:Any) = x match {
case EntityRef( s ) => entityName.equals( s );
case _ => false;
diff --git a/sources/scala/xml/FactoryAdapter.scala b/sources/scala/xml/FactoryAdapter.scala
index c2cf22efb7..b9f8fc3d6b 100644
--- a/sources/scala/xml/FactoryAdapter.scala
+++ b/sources/scala/xml/FactoryAdapter.scala
@@ -23,9 +23,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
-//import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.ParserAdapter;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -59,7 +57,8 @@ abstract class FactoryAdapter extends DefaultHandler() {
* @param chIter
* @return a new XML element.
*/
- def createNode(elemName:String ,
+ def createNode(uri:String,
+ elemName:String ,
attribs:HashMap[String,String] ,
chIter:List[Node] ):Node; //abstract
@@ -186,7 +185,7 @@ abstract class FactoryAdapter extends DefaultHandler() {
}
// create element
- rootElem = createNode( localName, attribMap, v );
+ rootElem = createNode( uri, localName, attribMap, v );
hStack.push(rootElem);
// set
diff --git a/sources/scala/xml/Node.scala b/sources/scala/xml/Node.scala
index ac00ea1fce..7ea4859a6f 100644
--- a/sources/scala/xml/Node.scala
+++ b/sources/scala/xml/Node.scala
@@ -18,6 +18,9 @@ object Node {
val NoAttributes: immutable.TreeMap[String,String] =
immutable.TreeMap.Empty[String,String];
+ /** the constant empty attribute map */
+ val EmptyNamespace: Int = 0;
+
}
/** Trait for representing XML using nodes of a labelled tree.
* This trait contains an implementation of a subset of XPath for navigation.
@@ -30,6 +33,9 @@ trait Node {
/** QName (the label of this node). I.e. "foo" for &lt;foo/&gt;) */
def label: String;
+ /** the namespace code of this node */
+ val namespaceCode: Int;
+
/** attribute axis */
def attribute: Map[String,String] ;
@@ -85,7 +91,7 @@ trait Node {
})
}
- override def hashCode() = Utility.hashCode(label, attribute.toList.hashCode(), child);
+ override def hashCode() = Utility.hashCode(namespaceCode, label, attribute.toList.hashCode(), child);
/** string representation of this node */
override def toString() = Utility.toXML(this);
diff --git a/sources/scala/xml/ProcInstr.scala b/sources/scala/xml/ProcInstr.scala
index fc2324f619..cda515ee39 100644
--- a/sources/scala/xml/ProcInstr.scala
+++ b/sources/scala/xml/ProcInstr.scala
@@ -41,6 +41,9 @@ case class ProcInstr( target:String, text:Option[String] ) extends Node {
/** the constant "#PI" */
final def label = "#PI";
+ /** always 0 */
+ final val namespaceCode = 0;
+
/** always empty */
final def attribute = Node.NoAttributes;
diff --git a/sources/scala/xml/Text.scala b/sources/scala/xml/Text.scala
index 7490389437..489ad031f6 100644
--- a/sources/scala/xml/Text.scala
+++ b/sources/scala/xml/Text.scala
@@ -24,6 +24,9 @@ case class Text( text:String ) extends Node {
*/
def label = "#PCDATA";
+ /** always 0 */
+ final val namespaceCode = 0;
+
final override def equals(x:Any) = x match {
case s:String => text.equals( s );
case Text( s ) => text.equals( s );
diff --git a/sources/scala/xml/Utility.scala b/sources/scala/xml/Utility.scala
index 685c40c334..1bc47d7d3a 100644
--- a/sources/scala/xml/Utility.scala
+++ b/sources/scala/xml/Utility.scala
@@ -100,13 +100,13 @@ object Utility {
}
/** returns a hashcode for the given constituents of a node */
- def hashCode( label:String, attribHashCode:int, children:Seq[Node] ) = {
- label.hashCode() + attribHashCode + children.hashCode()
+ def hashCode(uriCode:int, label:String, attribHashCode:int, children:Seq[Node]) = {
+ 41 * uriCode % 7 + label.hashCode() + attribHashCode + children.hashCode()
}
/** returns a hashcode for the given constituents of a node */
- def hashCode( label:String, attribs:scala.collection.mutable.HashMap[String,String], children:Seq[Node] ) = {
- label.hashCode() + attribs.toList.hashCode() + children.hashCode()
+ def hashCode(uriCode:int, label:String, attribs:scala.collection.mutable.HashMap[String,String], children:Seq[Node]) = {
+ 41 * uriCode % 7 + label.hashCode() + attribs.toList.hashCode() + children.hashCode()
}
/** NameChar ::= Letter | Digit | '.' | '-' | '_' | ':'
diff --git a/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala b/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala
index 775791202b..88456ec026 100644
--- a/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala
+++ b/sources/scala/xml/nobinding/NoBindingFactoryAdapter.scala
@@ -8,9 +8,8 @@
\* */
package scala.xml.nobinding;
-import scala.collection.mutable ;
-import scala.collection.immutable ;
-import scala.xml.{Elem, Node,Text,FactoryAdapter,Utility} ;
+import scala.collection.{ immutable, mutable };
+import scala.xml.{ Elem, Node, Text, FactoryAdapter, Utility };
import org.xml.sax.InputSource;
/** nobinding adaptor providing callbacks to parser to create elements.
@@ -31,20 +30,21 @@ class NoBindingFactoryAdapter extends FactoryAdapter {
/** creates a node. never creates the same node twice, using hash-consing
*/
- def createNode( label: String, attrs: mutable.HashMap[String,String], children: List[Node] ):Elem = {
+ def createNode(uri:String,
+ label: String,
+ attrs: mutable.HashMap[String,String],
+ children: List[Node] ):Elem = {
- val elHashCode = Utility.hashCode( label, attrs, children ) ;
+ val ncode = NamespaceRegistry.getCode( uri );
+ val elHashCode = Utility.hashCode( ncode, label, attrs, children ) ;
val attrMap = immutable.TreeMap.Empty[String,String] incl attrs;
cache.get( elHashCode ).match{
case Some(cachedElem) =>
//System.err.println("[using cached elem +"+cachedElem.toXML+"!]"); //DEBUG
cachedElem
- case None => val el = if( children.isEmpty ) {
- Elem( label, attrMap )
- } else {
- Elem( label, attrMap, children:_* ) ;
- }
+ case None =>
+ val el = Elem( ncode, label, attrMap, children:_* );
cache.update( elHashCode, el );
el
}
diff --git a/test/files/jvm/xmlLiterals.scala b/test/files/jvm/xmlLiterals.scala
index c751a5c8a7..85cd3f47cf 100644
--- a/test/files/jvm/xmlLiterals.scala
+++ b/test/files/jvm/xmlLiterals.scala
@@ -48,10 +48,10 @@ object Test {
assertEquals( noWS( x3 ),
- Elem("hello",e,
- Elem("world",e),
- Elem("test",e),
- Elem("mars",e)).toString() );
+ Elem(0,"hello",e,
+ Elem(0,"world",e),
+ Elem(0,"test",e),
+ Elem(0,"mars",e)).toString() );
/* === attributes === */
@@ -64,11 +64,11 @@ object Test {
</html>.toString();
assertEquals( noWS( z ), noWS(
- Elem("html",e,
- Elem("body",e,
- Elem("h1",e,Text("Hello World")),
- Elem("p",e,Text("Check the "),
- Elem("a", e,Text("scala"))
+ Elem(0,"html",e,
+ Elem(0,"body",e,
+ Elem(0,"h1",e,Text("Hello World")),
+ Elem(0,"p",e,Text("Check the "),
+ Elem(0,"a", e,Text("scala"))
% Pair("href","scala.epfl.ch"),
Text("page!"))
) % Pair("background","#FFFFFF")
@@ -92,16 +92,16 @@ object Test {
/* === embedded Scala blocks === */
def computeDate() = {
- Elem("date", e, Text("now!"));
+ Elem(0,"date", e, Text("now!"));
}
/* embedding Scala strings as text and elements */
val sc = <hello>{ "World" }{ Text("42") }{ computeDate() }</hello>;
assertEquals( sc.child.elements.toList,
- List( Text("World"), Text("42"), Elem( "date", e,Text("now!") ) ) );
+ List( Text("World"), Text("42"), Elem(0, "date", e,Text("now!") ) ) );
assertEquals( sc.toString(),
- Elem("hello",e,Text("World42"),Elem("date",e,Text("now!"))).toString() );
+ Elem(0,"hello",e,Text("World42"),Elem(0,"date",e,Text("now!"))).toString() );
def foo( m:Node ):String = m match {
case <hello/> => "hello node"
@@ -124,11 +124,11 @@ object Test {
</tr>;
assertEquals( noWS( rows.toList.toString() ),
- noWS( List(Elem("tr",e,
- Elem("td",e,Text("1.1")),Elem("td",e,Text("1.2"))
+ noWS( List(Elem(0,"tr",e,
+ Elem(0,"td",e,Text("1.1")),Elem(0,"td",e,Text("1.2"))
),
- Elem("tr",e,
- Elem("td",e,Text("2.1")),Elem("td",e,Text("2.2"))
+ Elem(0,"tr",e,
+ Elem(0,"td",e,Text("2.1")),Elem(0,"td",e,Text("2.2"))
)
).toString() )
);
@@ -136,9 +136,9 @@ object Test {
val rows3 = <tr> a <!-- an XML comment --> b <?pinotext?> c <?pi text?> d </tr>;
// these are not equal as comments are valid XML Info items.
- assertEquals( rows2, Elem("tr",e,Comment(" an XML comment "),ProcInstr("pinotext",None),ProcInstr("pi",Some("text"))));
+ assertEquals( rows2, Elem(0,"tr",e,Comment(" an XML comment "),ProcInstr("pinotext",None),ProcInstr("pi",Some("text"))));
- assertEquals( rows3, Elem("tr",e,Text("a"),Comment(" an XML comment "),Text("b"),ProcInstr("pinotext",None),Text("c"),ProcInstr("pi",Some("text")),Text("d")));
+ assertEquals( rows3, Elem(0,"tr",e,Text("a"),Comment(" an XML comment "),Text("b"),ProcInstr("pinotext",None),Text("c"),ProcInstr("pi",Some("text")),Text("d")));
}
@@ -184,8 +184,8 @@ object Test03Servlet {
case <table>{ xs @ _* }</table> =>
<table align="center">{ beautify( xs )}</table>
- case Elem( label, _, xs @ _* ) =>
- new Elem( label, beautify( xs ):_*)
+ case Elem(0, label, _, xs @ _* ) =>
+ new Elem(0, label, beautify( xs ):_*)
case _ => n
}
@@ -239,14 +239,14 @@ object Test03Servlet {
Console.println( onlyOne );
val tryBrace = <try>Now escaped {{ braces } </try>;
- assertEquals( tryBrace, Elem("try",e,Text("Now escaped { braces }")));
+ assertEquals( tryBrace, Elem(0,"try",e,Text("Now escaped { braces }")));
val tryBrace2 = <try myAttrib={(3+4).toString() }> cool ?</try>;
assertEquals( tryBrace2.attribute("myAttrib"), "7" );
/* Scala comments are not allowed in XML literals. see neg(2) */
val zzz = <hello>/* no comment */</hello>;
- assertEquals( zzz, Elem("hello", e, Text("/* no comment */")));
+ assertEquals( zzz, Elem(0,"hello", e, Text("/* no comment */")));
}
diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala
index 95295838af..09bfcd084b 100644
--- a/test/files/jvm/xmlstuff.scala
+++ b/test/files/jvm/xmlstuff.scala
@@ -28,7 +28,8 @@ object Test with Application {
val c = new Node {
def label = "hello";
- def child = List(Elem("world",e));
+ val namespaceCode = 0;
+ def child = List(Elem(0,"world",e));
def attribute = e;
};
@@ -45,10 +46,10 @@ object Test with Application {
val i = new InputSource( new StringReader( x2 ));
val x2p = XML.load( i );
- assertEquals(x2p, Elem("book",e,
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("title",e,Text("Data on ze web"))));
+ assertEquals(x2p, Elem(0,"book",e,
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"title",e,Text("Data on ze web"))));
val xmlFile2 = "<bib><book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book><book><author>John Mitchell</author><title>Foundations of Programming Languages</title></book></bib>";
val isrc2 = new InputSource( new StringReader( xmlFile2 ) );
@@ -58,9 +59,9 @@ object Test with Application {
Console.println("xpath \\");
- assertSameElements( parsedxml1 \ "_" , List( Elem("world",e) ) );
+ assertSameElements( parsedxml1 \ "_" , List( Elem(0,"world",e) ) );
- assertSameElements( parsedxml1 \ "world", List( Elem("world",e) ) );
+ assertSameElements( parsedxml1 \ "world", List( Elem(0,"world",e) ) );
/*
Console.println( parsedxml2 \ "_" );
@@ -73,13 +74,13 @@ object Test with Application {
parsedxml2 \ "_" ,
List(
- Elem("book", e,
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("title",e,Text("Data on ze web"))),
- Elem("book",e,
- Elem("author",e,Text("John Mitchell")),
- Elem("title",e,Text("Foundations of Programming Languages"))))
+ Elem(0,"book", e,
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"title",e,Text("Data on ze web"))),
+ Elem(0,"book",e,
+ Elem(0,"author",e,Text("John Mitchell")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages"))))
);
assertEquals( (parsedxml2 \ "author").length, 0 );
@@ -87,13 +88,13 @@ object Test with Application {
parsedxml2 \ "book",
List(
- Elem("book",e,
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("title",e,Text("Data on ze web"))),
- Elem("book",e,
- Elem("author",e,Text("John Mitchell")),
- Elem("title",e,Text("Foundations of Programming Languages")))
+ Elem(0,"book",e,
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"title",e,Text("Data on ze web"))),
+ Elem(0,"book",e,
+ Elem(0,"author",e,Text("John Mitchell")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages")))
)
);
@@ -102,11 +103,11 @@ object Test with Application {
parsedxml2 \ "_" \ "_",
List(
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("title",e,Text("Data on ze web")),
- Elem("author",e,Text("John Mitchell")),
- Elem("title",e,Text("Foundations of Programming Languages"))
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"title",e,Text("Data on ze web")),
+ Elem(0,"author",e,Text("John Mitchell")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages"))
)
);
@@ -115,9 +116,9 @@ object Test with Application {
parsedxml2 \ "_" \ "author",
List(
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("author",e,Text("John Mitchell"))
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"author",e,Text("John Mitchell"))
)
);
@@ -131,9 +132,9 @@ object Test with Application {
parsedxml2 \\ "author",
List(
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("author",e,Text("John Mitchell"))
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"author",e,Text("John Mitchell"))
)
);
@@ -143,30 +144,30 @@ object Test with Application {
new NodeSeq(List( parsedxml2 )) \\ "_",
List(
- Elem("bib",e,
- Elem("book",e,
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("title",e,Text("Data on ze web"))),
- Elem("book",e,
- Elem("author",e,Text("John Mitchell")),
- Elem("title",e,Text("Foundations of Programming Languages")))),
- Elem("book",e,
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("title",e,Text("Data on ze web"))),
- Elem("author",e,Text("Peter Buneman")),
+ Elem(0,"bib",e,
+ Elem(0,"book",e,
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"title",e,Text("Data on ze web"))),
+ Elem(0,"book",e,
+ Elem(0,"author",e,Text("John Mitchell")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages")))),
+ Elem(0,"book",e,
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"title",e,Text("Data on ze web"))),
+ Elem(0,"author",e,Text("Peter Buneman")),
Text("Peter Buneman"),
- Elem("author",e,Text("Dan Suciu")),
+ Elem(0,"author",e,Text("Dan Suciu")),
Text("Dan Suciu"),
- Elem("title",e,Text("Data on ze web")),
+ Elem(0,"title",e,Text("Data on ze web")),
Text("Data on ze web"),
- Elem("book",e,
- Elem("author",e,Text("John Mitchell")),
- Elem("title",e,Text("Foundations of Programming Languages"))),
- Elem("author",e,Text("John Mitchell")),
+ Elem(0,"book",e,
+ Elem(0,"author",e,Text("John Mitchell")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages"))),
+ Elem(0,"author",e,Text("John Mitchell")),
Text("John Mitchell"),
- Elem("title",e,Text("Foundations of Programming Languages")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages")),
Text("Foundations of Programming Languages")
)
);
@@ -177,8 +178,8 @@ object Test with Application {
parsedxml2 \\ "title",
List(
- Elem("title",e,Text("Data on ze web")),
- Elem("title",e,Text("Foundations of Programming Languages")))
+ Elem(0,"title",e,Text("Data on ze web")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages")))
);