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
44
45
46
47
48
49
50
51
52
53
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2004, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
** $Id$
\* */
package scala.xml.parsing;
import scala.xml.factory.NodeFactory ;
import org.xml.sax.InputSource;
/** nobinding adaptor providing callbacks to parser to create elements.
* implements hash-consing
*/
class NoBindingFactoryAdapter extends FactoryAdapter with NodeFactory[Elem] {
// -- FactoryAdapter methods
/** returns true. Every XML node may contain text that the application needs
**/
def nodeContainsText( label:java.lang.String ):boolean = true;
// methods for NodeFactory[Elem]
/** constructs an instance of scala.xml.Elem */
protected def create(pre: String, label: String, attrs: MetaData, scpe: NamespaceBinding, children:Seq[Node]): Elem = {
Elem( pre, label, attrs, scpe, children:_* );
}
// -- methods for FactoryAdapter
/** creates a node. never creates the same node twice, using hash-consing
*/
def createNode(pre:String, label: String, attrs: MetaData, scpe: NamespaceBinding, children: List[Node] ): Elem = {
//Console.println("NoBindingFactoryAdapter::createNode("+pre+","+label+","+attrs+","+scpe+","+children+")");
Elem( pre, label, attrs, scpe, children:_* );
//makeNode(pre, label, attrs, scpe, children);
}
/** creates a text node
*/
def createText( text:String ) =
Text( text );
/** loads an XML document, returning a Symbol node.
*/
override def loadXML( source:InputSource ):Elem =
super.loadXML( source ).asInstanceOf[ Elem ];
}
|