1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.commons.xml.tokenizer.wellformed;
22
23 import org.millscript.commons.xml.alerts.XmlWellFormednessAlert;
24 import org.millscript.commons.xml.api.token.DTDToken;
25 import org.millscript.commons.xml.api.token.TokenVisitor;
26
27 /**
28 * This class provides a token visitor the for second <code>Misc</code> section
29 * part of an XML document. This is the fourth token visitor in a chain that
30 * provides the well formedness checks required of an XML processor.
31 */
32 public class Misc2TokenVisitor extends Misc1TokenVisitor {
33
34 /**
35 * Constructs a new <code>Misc</code> section token visitor, with the
36 * specified token visitor.
37 *
38 * @param xt the well-formed XML tokenizer our tokens come from
39 */
40 public Misc2TokenVisitor( final WellFormedXmlTokenizer xt ) {
41 super( xt, new ElementTokenVisitor( xt ) );
42 }
43
44 /**
45 * Constructs a new <code>Misc</code> section token visitor, with the
46 * specified tokenizer and next-in-the-chain token visitor.
47 *
48 * @param xt the well-formed XML tokenizer our tokens come from
49 * @param tv the next token visitor in the well-formedness chain
50 */
51 Misc2TokenVisitor( final WellFormedXmlTokenizer xt, final TokenVisitor tv ) {
52 super( xt, tv );
53 }
54
55 /**
56 * @see org.millscript.commons.xml.api.token.TokenVisitor#visit(org.millscript.commons.xml.api.token.DTDToken)
57 */
58 @Override
59 public void visit( final DTDToken token ) {
60 throw new XmlWellFormednessAlert(
61 "Only one document type declaration can be used in a single XML document"
62 ).decorate( token ).mishap();
63 }
64
65 }