summaryrefslogtreecommitdiff
path: root/sources/scala/xml/parsing/ConstructingParser.scala
blob: e0c94833e6a6824d2c8bf5074a266b9dec01915f (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
41
42
43
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003-2005, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
** $Id$
\*                                                                      */

package scala.xml.parsing ;

import scala.io.Source;

object ConstructingParser {

  def fromFile(inp: java.io.File, preserveWS: Boolean) = {
    val p = new ConstructingParser(Source.fromFile(inp), preserveWS);
    p.nextch;
    p
  }

  def fromSource(inp: scala.io.Source, preserveWS: Boolean) = {
    val p = new ConstructingParser(inp, preserveWS);
    p.nextch;
    p
  }
}

/** an xml parser. parses XML and invokes callback methods of a MarkupHandler
 */
class ConstructingParser(inp: Source, presWS:Boolean)
extends  ConstructingHandler
with     ExternalSources
with     MarkupParser  {

  // default impl. of Logged
  override def log(msg:String): Unit = {}

  val preserveWS = presWS;
  val input = inp;
  val handle = this;
}