summaryrefslogtreecommitdiff
path: root/test/files/xml/xhtml.scala
blob: 2e3998732c5b70b5ec4977cf81a6b4411ffb83aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// $Id$

import scala.xml.{Attribute, AttributeSeq, Node, Text};
import dtd._;

object Test {

  val n = Node.NoAttributes;

  def main( argv:Array[String] ) = {
    val link = A(
      AttributeSeq.fromAttrs(
        Attribute("","href","http://lampwww.epfl.ch")
      ),
      Text("link")
    );

    //val m = new scala.collection.mutable.HashMap[String, String];
    //m.put("href","http://lampwww.epfl.ch");
    //link.setAttribs(m);

    val body = Body(n,
      H1(n,Text("Welcome to xhtml in scala")),
      P(n,Text( "a paragraph")),
      P(n,Text("another one, with a "),link,Text(" to the LAMP homepage.")));
    val page = Html(n,
                    Head(n,
                         Base(
                           AttributeSeq.fromAttrs(
                             Attribute("","href","http://here.edu")
                           )),
                         Title(n,Text("a basic xhtml page"))),
                    body);
    System.out.println( page ) ;

    val doc = load(argv(0));
    System.out.println( doc );
  }

}