blob: 014c7046aa230a6e509a281a7c2cd0d76050beea (
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
44
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2004, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
** $Id$
\* */
package scala.xml.dtd;
/** an XML node for document type declaration
*
* @author Burak Emir
* @param target name of this DOCTYPE
* @param extID None, or Some(external ID of this doctype)
* @param intSubset sequence of internal subset declarations
**/
case class DocType( name:String, extID:ExternalID, intSubset:Seq[dtd.Decl]) {
if( !Utility.isName( name ) )
throw new IllegalArgumentException(name+" must be an XML Name");
/** hashcode for this processing instruction */
final override def hashCode() = name.hashCode() + 7 * extID.hashCode() + 41*intSubset.toList.hashCode();
/** returns "<!DOCTYPE + name + extID? + ("["+intSubSet+"]")? >" */
final override def toString() = {
val sb = new StringBuffer("<!DOCTYPE ");
sb.append( name );
sb.append(' ');
sb.append(extID.toString());
if( intSubset.length > 0 ) {
sb.append('[');
for( val d <- intSubset ) {
sb.append( d.toString() );
}
sb.append(']');
}
sb.append('>');
sb.toString();
}
}
|