…lines 1–8 unchanged (8 lines)
9 * A {@code <!DOCTYPE>} node.
10 */
11public class DocumentType extends Node {
12 public static final String PUBLIC_KEY = "PUBLIC";
13 public static final String SYSTEM_KEY = "SYSTEM";
14 private static final String NAME = "name";
15 private static final String PUB_SYS_KEY = "pubSysKey"; // PUBLIC or SYSTEM
16 private static final String PUBLIC_ID = "publicId";
17 private static final String SYSTEM_ID = "systemId";
18 // todo: quirk mode from publicId and systemId
19
20 /**
21 * Create a new doctype element.
…lines 22–25 unchanged (4 lines)
26 */
27 public DocumentType(String name, String publicId, String systemId, String baseUri) {
28 super(baseUri);
29
30 attr(NAME, name);
31 attr(PUBLIC_ID, publicId);
32 if (has(PUBLIC_ID)) {
33 attr(PUB_SYS_KEY, PUBLIC_KEY);
34 }
35 attr(SYSTEM_ID, systemId);
36 }
37
38 /**
39 * Create a new doctype element.
40 * @param name the doctype's name
41 * @param publicId the doctype's public ID
42 * @param systemId the doctype's system ID
43 * @param baseUri the doctype's base URI
44 */
45 public DocumentType(String name, String pubSysKey, String publicId, String systemId, String baseUri) {
46 super(baseUri);
47
48 attr(NAME, name);
49 if (pubSysKey != null) {
50 attr(PUB_SYS_KEY, pubSysKey);
51 }
52 attr(PUBLIC_ID, publicId);
53 attr(SYSTEM_ID, systemId);
54 }
55
56 @Override
57 public String nodeName() {
58 return "#doctype";
59 }
60
…lines 61–64 unchanged (4 lines)
65 accum.append("<!doctype");
66 } else {
67 accum.append("<!DOCTYPE");
68 }
69 if (has(NAME))
70 accum.append(" ").append(attr(NAME));
71 if (has(PUB_SYS_KEY))
72 accum.append(" ").append(attr(PUB_SYS_KEY));
73 if (has(PUBLIC_ID))
74 accum.append(" \"").append(attr(PUBLIC_ID)).append('"');
75 if (has(SYSTEM_ID))
76 accum.append(" \"").append(attr(SYSTEM_ID)).append('"');
77 accum.append('>');
78 }
79
80 @Override
…lines 81–88 unchanged (8 lines)