|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| package nu.xom.tests; |
|
22 |
| |
|
23 |
| import nu.xom.*; |
|
24 |
| import nu.xom.Attribute.Type; |
|
25 |
| |
|
26 |
| class ANodeFactory extends NodeFactory { |
|
27 |
| |
|
28 |
2
| public Nodes makeAttribute(String name, String URI, String value, Type type) {
|
|
29 |
2
| return new Nodes(new AnAttribute(name, URI, value, type));
|
|
30 |
| } |
|
31 |
| |
|
32 |
2
| public Nodes makeComment(String data) {
|
|
33 |
2
| return new Nodes(new AComment(data));
|
|
34 |
| } |
|
35 |
| |
|
36 |
7
| public Nodes makeText(String text) {
|
|
37 |
7
| return new Nodes(new AText(text));
|
|
38 |
| } |
|
39 |
| |
|
40 |
1
| public Nodes makeDocType(String rootElementName, String publicID, String systemID) {
|
|
41 |
1
| return new Nodes(new ADocType(rootElementName, publicID, systemID));
|
|
42 |
| } |
|
43 |
| |
|
44 |
1
| public Nodes makeProcessingInstruction(String target, String data) {
|
|
45 |
1
| return new Nodes(new AProcessingInstruction(target, data));
|
|
46 |
| } |
|
47 |
| |
|
48 |
1
| public Document startMakingDocument() {
|
|
49 |
1
| return new ADocument(new AElement("foo", "http://www,examle.com"));
|
|
50 |
| } |
|
51 |
| |
|
52 |
8
| public Element startMakingElement(String name, String namespace) {
|
|
53 |
8
| return new AElement(name, namespace);
|
|
54 |
| } |
|
55 |
| |
|
56 |
| } |
|
57 |
| |
|
58 |
| |
|
59 |
| class AElement extends Element { |
|
60 |
| |
|
61 |
9
| public AElement(String name, String uri) {
|
|
62 |
9
| super(name, uri);
|
|
63 |
| } |
|
64 |
| |
|
65 |
| } |
|
66 |
| |
|
67 |
| |
|
68 |
| class ADocument extends Document { |
|
69 |
| |
|
70 |
1
| public ADocument(Element root) {
|
|
71 |
1
| super(root);
|
|
72 |
| } |
|
73 |
| |
|
74 |
| } |
|
75 |
| |
|
76 |
| |
|
77 |
| class AText extends Text { |
|
78 |
| |
|
79 |
7
| public AText(String text) {
|
|
80 |
7
| super(text);
|
|
81 |
| } |
|
82 |
| |
|
83 |
| } |
|
84 |
| |
|
85 |
| |
|
86 |
| class AComment extends Comment { |
|
87 |
| |
|
88 |
2
| public AComment(String text) {
|
|
89 |
2
| super(text);
|
|
90 |
| } |
|
91 |
| |
|
92 |
| } |
|
93 |
| |
|
94 |
| |
|
95 |
| class AProcessingInstruction extends ProcessingInstruction { |
|
96 |
| |
|
97 |
1
| public AProcessingInstruction(String target, String data) {
|
|
98 |
1
| super(target, data);
|
|
99 |
| } |
|
100 |
| |
|
101 |
| } |
|
102 |
| |
|
103 |
| |
|
104 |
| class ADocType extends DocType { |
|
105 |
| |
|
106 |
1
| public ADocType(String rootElementName, String publicID, String systemID) {
|
|
107 |
1
| super(rootElementName, publicID, systemID);
|
|
108 |
| } |
|
109 |
| |
|
110 |
| } |
|
111 |
| |
|
112 |
| |
|
113 |
| class AnAttribute extends Attribute { |
|
114 |
| |
|
115 |
2
| public AnAttribute(String name, String URI, String value, Type type) {
|
|
116 |
2
| super(name, URI, value, type);
|
|
117 |
| } |
|
118 |
| |
|
119 |
| } |