summaryrefslogblamecommitdiff
path: root/test/files/jvm/xmlpull.scala
blob: d2bb72a071870368eb2a424e40e4618f994d6aa0 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                         
                                    

                                                          

                   

                                                          
                   

                                                  
                   
                                        
     

                                                  



                                                    


   
import scala.xml._
import scala.xml.pull._
import scala.io.Source

object Test {

  val src = Source.fromString("<hello><world/>!</hello>")

  def main(args: Array[String]) {
    var er = new XMLEventReader(src)
    er.next match {
      case EvElemStart(_, "hello", _, _) => //println("1")
    }
    er.next match {
      case EvElemStart(_, "world", _, _) => //println("2")
    }
    er.next match {
      case EvElemEnd(_, "world") => //println("3")
    }
    er.next match {
      case EvText("!") => //println("4")
    }
    er.next match {
      case EvElemEnd(_, "hello") => //println("5")
    }
    // you get the picture...
    er.stop  // allow thread to be garbage-collected
    //println("6")
  }
}