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
|
package scala.xml.dtd;
import scala.io.Source;
import scala.collection.mutable.{ HashMap, Map }
/** a document type declaration */
abstract class DTD {
var externalID: ExternalID = null;
def notations: Seq[NotationDecl] = Nil;
def unparsedEntities: Seq[EntityDecl] = Nil;
var elem: Map[String, ElemDecl] = new HashMap[String, ElemDecl]();
var attr: Map[String, AttListDecl] = new HashMap[String, AttListDecl]();
var ent: Map[String, EntityDecl] = new HashMap[String, EntityDecl]();
var decls: List[Decl] = Nil;
//def getElemDecl(elem:String): ElemDecl;
//def getAttribDecl(elem: String, attr: String): AttrDecl;
override def toString() = {
val sb = new StringBuffer();
sb.append("DTD [\n");
if(null != externalID)
sb.append(externalID.toString()).append('\n');
for(val d <- decls)
sb.append(d.toString()).append('\n');
sb.append("]").toString()
}
/*
def initializeEntities() = {
for(val x <- decls) x match {
case y @ ParsedEntityDecl(name, _) => ent.update(name, y);
case y @ UnparsedEntityDecl(name, _, _) => ent.update(name, y);
case y @ ParameterEntityDecl(name, _) => ent.update(name, y);
case _ =>
}
}
*/
}
|