1 package org.opentrafficsim.editor;
2
3 import org.w3c.dom.DOMException;
4 import org.w3c.dom.Document;
5 import org.w3c.dom.NamedNodeMap;
6 import org.w3c.dom.Node;
7 import org.w3c.dom.NodeList;
8 import org.w3c.dom.UserDataHandler;
9
10
11
12
13
14
15
16
17
18
19 public final class XiIncludeNode implements Node
20 {
21
22
23 public static final Node XI_INCLUDE = new XiIncludeNode();
24
25
26 private static final Node FILE_CHILD = new FileNode(new Attributes("File"));
27
28
29 private static final Node FALLBACK_CHILD = new FileNode(new Attributes("Fallback"));
30
31
32
33
34 private XiIncludeNode()
35 {
36
37 }
38
39
40 @Override
41 public String getNodeName()
42 {
43 return "xi:include";
44 }
45
46
47 @Override
48 public String getNodeValue() throws DOMException
49 {
50 return null;
51 }
52
53
54 @Override
55 public void setNodeValue(final String nodeValue) throws DOMException
56 {
57 }
58
59
60 @Override
61 public short getNodeType()
62 {
63 return Node.TEXT_NODE;
64 }
65
66
67 @Override
68 public Node getParentNode()
69 {
70 return null;
71 }
72
73
74 @Override
75 public NodeList getChildNodes()
76 {
77 return new NodeList()
78 {
79
80 @Override
81 public Node item(final int index)
82 {
83 if (index == 0)
84 {
85 return FILE_CHILD;
86 }
87 if (index == 1)
88 {
89 return FALLBACK_CHILD;
90 }
91 return null;
92 }
93
94
95 @Override
96 public int getLength()
97 {
98 return 2;
99 }
100 };
101 }
102
103
104 @Override
105 public Node getFirstChild()
106 {
107 return FILE_CHILD;
108 }
109
110
111 @Override
112 public Node getLastChild()
113 {
114 return FALLBACK_CHILD;
115 }
116
117
118 @Override
119 public Node getPreviousSibling()
120 {
121 return null;
122 }
123
124
125 @Override
126 public Node getNextSibling()
127 {
128 return null;
129 }
130
131
132 @Override
133 public NamedNodeMap getAttributes()
134 {
135 return null;
136 }
137
138
139 @Override
140 public Document getOwnerDocument()
141 {
142 return null;
143 }
144
145
146 @Override
147 public Node insertBefore(final Node newChild, final Node refChild) throws DOMException
148 {
149 return null;
150 }
151
152
153 @Override
154 public Node replaceChild(final Node newChild, final Node oldChild) throws DOMException
155 {
156 return null;
157 }
158
159
160 @Override
161 public Node removeChild(final Node oldChild) throws DOMException
162 {
163 return null;
164 }
165
166
167 @Override
168 public Node appendChild(final Node newChild) throws DOMException
169 {
170 return null;
171 }
172
173
174 @Override
175 public boolean hasChildNodes()
176 {
177 return true;
178 }
179
180
181 @Override
182 public Node cloneNode(final boolean deep)
183 {
184 return null;
185 }
186
187
188 @Override
189 public void normalize()
190 {
191 }
192
193
194 @Override
195 public boolean isSupported(final String feature, final String version)
196 {
197 return false;
198 }
199
200
201 @Override
202 public String getNamespaceURI()
203 {
204 return null;
205 }
206
207
208 @Override
209 public String getPrefix()
210 {
211 return null;
212 }
213
214
215 @Override
216 public void setPrefix(final String prefix) throws DOMException
217 {
218 }
219
220
221 @Override
222 public String getLocalName()
223 {
224 return null;
225 }
226
227
228 @Override
229 public boolean hasAttributes()
230 {
231 return false;
232 }
233
234
235 @Override
236 public String getBaseURI()
237 {
238 return null;
239 }
240
241
242 @Override
243 public short compareDocumentPosition(final Node other) throws DOMException
244 {
245 return 0;
246 }
247
248
249 @Override
250 public String getTextContent() throws DOMException
251 {
252 return null;
253 }
254
255
256 @Override
257 public void setTextContent(final String textContent) throws DOMException
258 {
259 }
260
261
262 @Override
263 public boolean isSameNode(final Node other)
264 {
265 return false;
266 }
267
268
269 @Override
270 public String lookupPrefix(final String namespaceURI)
271 {
272 return null;
273 }
274
275
276 @Override
277 public boolean isDefaultNamespace(final String namespaceURI)
278 {
279 return false;
280 }
281
282
283 @Override
284 public String lookupNamespaceURI(final String prefix)
285 {
286 return null;
287 }
288
289
290 @Override
291 public boolean isEqualNode(final Node arg)
292 {
293 return false;
294 }
295
296
297 @Override
298 public Object getFeature(final String feature, final String version)
299 {
300 return null;
301 }
302
303
304 @Override
305 public Object setUserData(final String key, final Object data, final UserDataHandler handler)
306 {
307 return null;
308 }
309
310
311 @Override
312 public Object getUserData(final String key)
313 {
314 return null;
315 }
316
317
318
319
320
321
322
323
324
325 private static class FileNode implements Node
326 {
327
328
329 private final Attributes attributes;
330
331
332
333
334
335 public FileNode(final Attributes attributes)
336 {
337 this.attributes = attributes;
338 }
339
340
341 @Override
342 public String getNodeName()
343 {
344 return "xsd:attribute";
345 }
346
347
348 @Override
349 public String getNodeValue() throws DOMException
350 {
351 return null;
352 }
353
354
355 @Override
356 public void setNodeValue(final String nodeValue) throws DOMException
357 {
358 }
359
360
361 @Override
362 public short getNodeType()
363 {
364 return Node.ATTRIBUTE_NODE;
365 }
366
367
368 @Override
369 public Node getParentNode()
370 {
371 return null;
372 }
373
374
375 @Override
376 public NodeList getChildNodes()
377 {
378 return null;
379 }
380
381
382 @Override
383 public Node getFirstChild()
384 {
385 return null;
386 }
387
388
389 @Override
390 public Node getLastChild()
391 {
392 return null;
393 }
394
395
396 @Override
397 public Node getPreviousSibling()
398 {
399 return null;
400 }
401
402
403 @Override
404 public Node getNextSibling()
405 {
406 return null;
407 }
408
409
410 @Override
411 public NamedNodeMap getAttributes()
412 {
413 return this.attributes;
414 }
415
416
417 @Override
418 public Document getOwnerDocument()
419 {
420 return null;
421 }
422
423
424 @Override
425 public Node insertBefore(final Node newChild, final Node refChild) throws DOMException
426 {
427 return null;
428 }
429
430
431 @Override
432 public Node replaceChild(final Node newChild, final Node oldChild) throws DOMException
433 {
434 return null;
435 }
436
437
438 @Override
439 public Node removeChild(final Node oldChild) throws DOMException
440 {
441 return null;
442 }
443
444
445 @Override
446 public Node appendChild(final Node newChild) throws DOMException
447 {
448 return null;
449 }
450
451
452 @Override
453 public boolean hasChildNodes()
454 {
455 return false;
456 }
457
458
459 @Override
460 public Node cloneNode(final boolean deep)
461 {
462 return null;
463 }
464
465
466 @Override
467 public void normalize()
468 {
469 }
470
471
472 @Override
473 public boolean isSupported(final String feature, final String version)
474 {
475 return false;
476 }
477
478
479 @Override
480 public String getNamespaceURI()
481 {
482 return null;
483 }
484
485
486 @Override
487 public String getPrefix()
488 {
489 return null;
490 }
491
492
493 @Override
494 public void setPrefix(final String prefix) throws DOMException
495 {
496 }
497
498
499 @Override
500 public String getLocalName()
501 {
502 return null;
503 }
504
505
506 @Override
507 public boolean hasAttributes()
508 {
509 return true;
510 }
511
512
513 @Override
514 public String getBaseURI()
515 {
516 return null;
517 }
518
519
520 @Override
521 public short compareDocumentPosition(final Node other) throws DOMException
522 {
523 return 0;
524 }
525
526
527 @Override
528 public String getTextContent() throws DOMException
529 {
530 return null;
531 }
532
533
534 @Override
535 public void setTextContent(final String textContent) throws DOMException
536 {
537 }
538
539
540 @Override
541 public boolean isSameNode(final Node other)
542 {
543 return false;
544 }
545
546
547 @Override
548 public String lookupPrefix(final String namespaceURI)
549 {
550 return null;
551 }
552
553
554 @Override
555 public boolean isDefaultNamespace(final String namespaceURI)
556 {
557 return false;
558 }
559
560
561 @Override
562 public String lookupNamespaceURI(final String prefix)
563 {
564 return null;
565 }
566
567
568 @Override
569 public boolean isEqualNode(final Node arg)
570 {
571 return false;
572 }
573
574
575 @Override
576 public Object getFeature(final String feature, final String version)
577 {
578 return null;
579 }
580
581
582 @Override
583 public Object setUserData(final String key, final Object data, final UserDataHandler handler)
584 {
585 return null;
586 }
587
588
589 @Override
590 public Object getUserData(final String key)
591 {
592 return null;
593 }
594
595 }
596
597
598
599
600
601
602
603
604
605 private static class Attributes implements NamedNodeMap
606 {
607
608
609 private final String name;
610
611
612
613
614
615 public Attributes(final String name)
616 {
617 this.name = name;
618 }
619
620
621 private Node file = new Node()
622 {
623
624
625 @Override
626 public String getNodeName()
627 {
628 return null;
629 }
630
631
632 @Override
633 public String getNodeValue() throws DOMException
634 {
635 return Attributes.this.name;
636 }
637
638
639 @Override
640 public void setNodeValue(final String nodeValue) throws DOMException
641 {
642 }
643
644
645 @Override
646 public short getNodeType()
647 {
648 return 0;
649 }
650
651
652 @Override
653 public Node getParentNode()
654 {
655 return null;
656 }
657
658
659 @Override
660 public NodeList getChildNodes()
661 {
662 return null;
663 }
664
665
666 @Override
667 public Node getFirstChild()
668 {
669 return null;
670 }
671
672
673 @Override
674 public Node getLastChild()
675 {
676 return null;
677 }
678
679
680 @Override
681 public Node getPreviousSibling()
682 {
683 return null;
684 }
685
686
687 @Override
688 public Node getNextSibling()
689 {
690 return null;
691 }
692
693
694 @Override
695 public NamedNodeMap getAttributes()
696 {
697 return null;
698 }
699
700
701 @Override
702 public Document getOwnerDocument()
703 {
704 return null;
705 }
706
707
708 @Override
709 public Node insertBefore(final Node newChild, final Node refChild) throws DOMException
710 {
711 return null;
712 }
713
714
715 @Override
716 public Node replaceChild(final Node newChild, final Node oldChild) throws DOMException
717 {
718 return null;
719 }
720
721
722 @Override
723 public Node removeChild(final Node oldChild) throws DOMException
724 {
725 return null;
726 }
727
728
729 @Override
730 public Node appendChild(final Node newChild) throws DOMException
731 {
732 return null;
733 }
734
735
736 @Override
737 public boolean hasChildNodes()
738 {
739 return false;
740 }
741
742
743 @Override
744 public Node cloneNode(final boolean deep)
745 {
746 return null;
747 }
748
749
750 @Override
751 public void normalize()
752 {
753 }
754
755
756 @Override
757 public boolean isSupported(final String feature, final String version)
758 {
759 return false;
760 }
761
762
763 @Override
764 public String getNamespaceURI()
765 {
766 return null;
767 }
768
769
770 @Override
771 public String getPrefix()
772 {
773 return null;
774 }
775
776
777 @Override
778 public void setPrefix(final String prefix) throws DOMException
779 {
780 }
781
782
783 @Override
784 public String getLocalName()
785 {
786 return null;
787 }
788
789
790 @Override
791 public boolean hasAttributes()
792 {
793 return false;
794 }
795
796
797 @Override
798 public String getBaseURI()
799 {
800 return null;
801 }
802
803
804 @Override
805 public short compareDocumentPosition(final Node other) throws DOMException
806 {
807 return 0;
808 }
809
810
811 @Override
812 public String getTextContent() throws DOMException
813 {
814 return null;
815 }
816
817
818 @Override
819 public void setTextContent(final String textContent) throws DOMException
820 {
821 }
822
823
824 @Override
825 public boolean isSameNode(final Node other)
826 {
827 return false;
828 }
829
830
831 @Override
832 public String lookupPrefix(final String namespaceURI)
833 {
834 return null;
835 }
836
837
838 @Override
839 public boolean isDefaultNamespace(final String namespaceURI)
840 {
841 return false;
842 }
843
844
845 @Override
846 public String lookupNamespaceURI(final String prefix)
847 {
848 return null;
849 }
850
851
852 @Override
853 public boolean isEqualNode(final Node arg)
854 {
855 return false;
856 }
857
858
859 @Override
860 public Object getFeature(final String feature, final String version)
861 {
862 return null;
863 }
864
865
866 @Override
867 public Object setUserData(final String key, final Object data, final UserDataHandler handler)
868 {
869 return null;
870 }
871
872
873 @Override
874 public Object getUserData(final String key)
875 {
876 return null;
877 }
878
879 };
880
881
882 @Override
883 public Node getNamedItem(final String name)
884 {
885 if (name.equals("name"))
886 {
887 return this.file;
888 }
889 return null;
890 }
891
892
893 @Override
894 public Node setNamedItem(final Node arg) throws DOMException
895 {
896 return null;
897 }
898
899
900 @Override
901 public Node removeNamedItem(final String name) throws DOMException
902 {
903 return null;
904 }
905
906
907 @Override
908 public Node item(final int index)
909 {
910 if (index == 0)
911 {
912 return this.file;
913 }
914 return null;
915 }
916
917
918 @Override
919 public int getLength()
920 {
921 return 1;
922 }
923
924
925 @Override
926 public Node getNamedItemNS(final String namespaceURI, final String localName) throws DOMException
927 {
928 return null;
929 }
930
931
932 @Override
933 public Node setNamedItemNS(final Node arg) throws DOMException
934 {
935 return null;
936 }
937
938
939 @Override
940 public Node removeNamedItemNS(final String namespaceURI, final String localName) throws DOMException
941 {
942 return null;
943 }
944
945 }
946
947 }