KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > bugs > issues > IssuesScanner


1 /*
2  * File: IssuesScanner.java
3  * Generated from: issues-1_0.dtd
4  * Date: 13. September 2004 18:53
5  *
6  * @author tim
7  * @version generated by NetBeans XML module
8  */

9
10 package org.netbeans.modules.tasklist.bugs.issues;
11
12 import java.net.MalformedURLException JavaDoc;
13 import java.net.URL JavaDoc;
14
15 /**
16  *
17  * This is a scanner of DOM tree.
18  *
19  * Example:
20  * <pre>
21  * javax.xml.parsers.DocumentBuilderFactory builderFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
22  * javax.xml.parsers.DocumentBuilder builder = builderFactory.newDocumentBuilder();
23  * org.w3c.dom.Document document = builder.parse (new org.xml.sax.InputSource (???));
24  * <font color="blue">IssuesScanner scanner = new IssuesScanner (document);</font>
25  * <font color="blue">scanner.visitDocument();</font>
26  * </pre>
27  *
28  * @see org.w3c.dom.Document
29  * @see org.w3c.dom.Element
30  * @see org.w3c.dom.NamedNodeMap
31  */

32 public class IssuesScanner {
33     /**
34      * org.w3c.dom.Document document
35      */

36     org.w3c.dom.Document JavaDoc document;
37     
38     private IssuesList list;
39     private ProductComponent component;
40     private Person person;
41     private Issue issue;
42     
43     /**
44      * Create new IssuesScanner with org.w3c.dom.Document.
45      */

46     public IssuesScanner(org.w3c.dom.Document JavaDoc document) {
47         this.document = document;
48     }
49     
50     /**
51      * Scan through org.w3c.dom.Document document.
52      *
53      * @return read list of issues
54      */

55     public IssuesList visitDocument() {
56         list = new IssuesList();
57         org.w3c.dom.Element JavaDoc element = document.getDocumentElement();
58         if ((element != null) && element.getTagName().equals("issues")) {
59             visitElement_issues(element);
60         }
61         if ((element != null) && element.getTagName().equals("components")) {
62             visitElement_components(element);
63         }
64         if ((element != null) && element.getTagName().equals("component")) {
65             visitElement_component(element);
66         }
67         if ((element != null) && element.getTagName().equals("subcomponent")) {
68             visitElement_subcomponent(element);
69         }
70         if ((element != null) && element.getTagName().equals("statuses")) {
71             visitElement_statuses(element);
72         }
73         if ((element != null) && element.getTagName().equals("status")) {
74             visitElement_status(element);
75         }
76         if ((element != null) && element.getTagName().equals("platforms")) {
77             visitElement_platforms(element);
78         }
79         if ((element != null) && element.getTagName().equals("platform")) {
80             visitElement_platform(element);
81         }
82         if ((element != null) && element.getTagName().equals("operating-systems")) {
83             visitElement_operating_systems(element);
84         }
85         if ((element != null) && element.getTagName().equals("os")) {
86             visitElement_os(element);
87         }
88         if ((element != null) && element.getTagName().equals("versions")) {
89             visitElement_versions(element);
90         }
91         if ((element != null) && element.getTagName().equals("version")) {
92             visitElement_version(element);
93         }
94         if ((element != null) && element.getTagName().equals("priorities")) {
95             visitElement_priorities(element);
96         }
97         if ((element != null) && element.getTagName().equals("priority")) {
98             visitElement_priority(element);
99         }
100         if ((element != null) && element.getTagName().equals("issue-types")) {
101             visitElement_issue_types(element);
102         }
103         if ((element != null) && element.getTagName().equals("issue-type")) {
104             visitElement_issue_type(element);
105         }
106         if ((element != null) && element.getTagName().equals("persons")) {
107             visitElement_persons(element);
108         }
109         if ((element != null) && element.getTagName().equals("person")) {
110             visitElement_person(element);
111         }
112         if ((element != null) && element.getTagName().equals("resolutions")) {
113             visitElement_resolutions(element);
114         }
115         if ((element != null) && element.getTagName().equals("resolution")) {
116             visitElement_resolution(element);
117         }
118         if ((element != null) && element.getTagName().equals("issue")) {
119             visitElement_issue(element);
120         }
121         if ((element != null) && element.getTagName().equals("depends-on")) {
122             visitElement_depends_on(element);
123         }
124         if ((element != null) && element.getTagName().equals("comment")) {
125             visitElement_comment(element);
126         }
127         return list;
128     }
129     
130     /**
131      * Scan through org.w3c.dom.Element named issues.
132      */

133     void visitElement_issues(org.w3c.dom.Element JavaDoc element) { // <issues>
134
// element.getValue();
135
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
136         for (int i = 0; i < nodes.getLength(); i++) {
137             org.w3c.dom.Node JavaDoc node = nodes.item(i);
138             switch (node.getNodeType()) {
139                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
140                     // ((org.w3c.dom.CDATASection)node).getData();
141
break;
142                 case org.w3c.dom.Node.ELEMENT_NODE:
143                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
144                     if (nodeElement.getTagName().equals("components")) {
145                         visitElement_components(nodeElement);
146                     }
147                     if (nodeElement.getTagName().equals("statuses")) {
148                         visitElement_statuses(nodeElement);
149                     }
150                     if (nodeElement.getTagName().equals("platforms")) {
151                         visitElement_platforms(nodeElement);
152                     }
153                     if (nodeElement.getTagName().equals("operating-systems")) {
154                         visitElement_operating_systems(nodeElement);
155                     }
156                     if (nodeElement.getTagName().equals("versions")) {
157                         visitElement_versions(nodeElement);
158                     }
159                     if (nodeElement.getTagName().equals("priorities")) {
160                         visitElement_priorities(nodeElement);
161                     }
162                     if (nodeElement.getTagName().equals("issue-types")) {
163                         visitElement_issue_types(nodeElement);
164                     }
165                     if (nodeElement.getTagName().equals("persons")) {
166                         visitElement_persons(nodeElement);
167                     }
168                     if (nodeElement.getTagName().equals("resolutions")) {
169                         visitElement_resolutions(nodeElement);
170                     }
171                     if (nodeElement.getTagName().equals("issue")) {
172                         visitElement_issue(nodeElement);
173                     }
174                     break;
175                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
176                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
177
// ((org.w3c.dom.ProcessingInstruction)node).getData();
178
break;
179             }
180         }
181     }
182     
183     /**
184      * Scan through org.w3c.dom.Element named components.
185      */

186     void visitElement_components(org.w3c.dom.Element JavaDoc element) { // <components>
187
// element.getValue();
188
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
189         for (int i = 0; i < nodes.getLength(); i++) {
190             org.w3c.dom.Node JavaDoc node = nodes.item(i);
191             switch (node.getNodeType()) {
192                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
193                     // ((org.w3c.dom.CDATASection)node).getData();
194
break;
195                 case org.w3c.dom.Node.ELEMENT_NODE:
196                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
197                     if (nodeElement.getTagName().equals("component")) {
198                         visitElement_component(nodeElement);
199                     }
200                     break;
201                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
202                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
203
// ((org.w3c.dom.ProcessingInstruction)node).getData();
204
break;
205             }
206         }
207     }
208     
209     /**
210      * Scan through org.w3c.dom.Element named component.
211      */

212     void visitElement_component(org.w3c.dom.Element JavaDoc element) { // <component>
213
// element.getValue();
214
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
215         for (int i = 0; i < attrs.getLength(); i++) {
216             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
217             if (attr.getName().equals("name")) { // <component name="???">
218
component = new ProductComponent();
219                 component.name = attr.getValue();
220                 list.components.add(component);
221             }
222         }
223         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
224         for (int i = 0; i < nodes.getLength(); i++) {
225             org.w3c.dom.Node JavaDoc node = nodes.item(i);
226             switch (node.getNodeType()) {
227                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
228                     // ((org.w3c.dom.CDATASection)node).getData();
229
break;
230                 case org.w3c.dom.Node.ELEMENT_NODE:
231                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
232                     if (nodeElement.getTagName().equals("subcomponent")) {
233                         visitElement_subcomponent(nodeElement);
234                     }
235                     break;
236                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
237                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
238
// ((org.w3c.dom.ProcessingInstruction)node).getData();
239
break;
240             }
241         }
242     }
243     
244     /**
245      * Scan through org.w3c.dom.Element named subcomponent.
246      */

247     void visitElement_subcomponent(org.w3c.dom.Element JavaDoc element) { // <subcomponent>
248
// element.getValue();
249
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
250         for (int i = 0; i < attrs.getLength(); i++) {
251             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
252             if (attr.getName().equals("name")) { // <subcomponent name="???">
253
component.subcomponents.add(attr.getValue());
254             }
255         }
256         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
257         for (int i = 0; i < nodes.getLength(); i++) {
258             org.w3c.dom.Node JavaDoc node = nodes.item(i);
259             switch (node.getNodeType()) {
260                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
261                     // ((org.w3c.dom.CDATASection)node).getData();
262
break;
263                 case org.w3c.dom.Node.ELEMENT_NODE:
264                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
265                     break;
266                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
267                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
268
// ((org.w3c.dom.ProcessingInstruction)node).getData();
269
break;
270             }
271         }
272     }
273     
274     /**
275      * Scan through org.w3c.dom.Element named statuses.
276      */

277     void visitElement_statuses(org.w3c.dom.Element JavaDoc element) { // <statuses>
278
// element.getValue();
279
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
280         for (int i = 0; i < nodes.getLength(); i++) {
281             org.w3c.dom.Node JavaDoc node = nodes.item(i);
282             switch (node.getNodeType()) {
283                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
284                     // ((org.w3c.dom.CDATASection)node).getData();
285
break;
286                 case org.w3c.dom.Node.ELEMENT_NODE:
287                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
288                     if (nodeElement.getTagName().equals("status")) {
289                         visitElement_status(nodeElement);
290                     }
291                     break;
292                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
293                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
294
// ((org.w3c.dom.ProcessingInstruction)node).getData();
295
break;
296             }
297         }
298     }
299     
300     /**
301      * Scan through org.w3c.dom.Element named status.
302      */

303     void visitElement_status(org.w3c.dom.Element JavaDoc element) { // <status>
304
// element.getValue();
305
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
306         for (int i = 0; i < attrs.getLength(); i++) {
307             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
308             if (attr.getName().equals("name")) { // <status name="???">
309
list.statuses.add(attr.getValue());
310             }
311         }
312         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
313         for (int i = 0; i < nodes.getLength(); i++) {
314             org.w3c.dom.Node JavaDoc node = nodes.item(i);
315             switch (node.getNodeType()) {
316                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
317                     // ((org.w3c.dom.CDATASection)node).getData();
318
break;
319                 case org.w3c.dom.Node.ELEMENT_NODE:
320                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
321                     break;
322                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
323                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
324
// ((org.w3c.dom.ProcessingInstruction)node).getData();
325
break;
326             }
327         }
328     }
329     
330     /**
331      * Scan through org.w3c.dom.Element named platforms.
332      */

333     void visitElement_platforms(org.w3c.dom.Element JavaDoc element) { // <platforms>
334
// element.getValue();
335
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
336         for (int i = 0; i < nodes.getLength(); i++) {
337             org.w3c.dom.Node JavaDoc node = nodes.item(i);
338             switch (node.getNodeType()) {
339                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
340                     // ((org.w3c.dom.CDATASection)node).getData();
341
break;
342                 case org.w3c.dom.Node.ELEMENT_NODE:
343                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
344                     if (nodeElement.getTagName().equals("platform")) {
345                         visitElement_platform(nodeElement);
346                     }
347                     break;
348                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
349                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
350
// ((org.w3c.dom.ProcessingInstruction)node).getData();
351
break;
352             }
353         }
354     }
355     
356     /**
357      * Scan through org.w3c.dom.Element named platform.
358      */

359     void visitElement_platform(org.w3c.dom.Element JavaDoc element) { // <platform>
360
// element.getValue();
361
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
362         for (int i = 0; i < attrs.getLength(); i++) {
363             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
364             if (attr.getName().equals("name")) { // <platform name="???">
365
list.platforms.add(attr.getValue());
366             }
367         }
368         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
369         for (int i = 0; i < nodes.getLength(); i++) {
370             org.w3c.dom.Node JavaDoc node = nodes.item(i);
371             switch (node.getNodeType()) {
372                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
373                     // ((org.w3c.dom.CDATASection)node).getData();
374
break;
375                 case org.w3c.dom.Node.ELEMENT_NODE:
376                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
377                     break;
378                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
379                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
380
// ((org.w3c.dom.ProcessingInstruction)node).getData();
381
break;
382             }
383         }
384     }
385     
386     /**
387      * Scan through org.w3c.dom.Element named operating-systems.
388      */

389     void visitElement_operating_systems(org.w3c.dom.Element JavaDoc element) { // <operating-systems>
390
// element.getValue();
391
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
392         for (int i = 0; i < nodes.getLength(); i++) {
393             org.w3c.dom.Node JavaDoc node = nodes.item(i);
394             switch (node.getNodeType()) {
395                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
396                     // ((org.w3c.dom.CDATASection)node).getData();
397
break;
398                 case org.w3c.dom.Node.ELEMENT_NODE:
399                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
400                     if (nodeElement.getTagName().equals("os")) {
401                         visitElement_os(nodeElement);
402                     }
403                     break;
404                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
405                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
406
// ((org.w3c.dom.ProcessingInstruction)node).getData();
407
break;
408             }
409         }
410     }
411     
412     /**
413      * Scan through org.w3c.dom.Element named os.
414      */

415     void visitElement_os(org.w3c.dom.Element JavaDoc element) { // <os>
416
// element.getValue();
417
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
418         for (int i = 0; i < attrs.getLength(); i++) {
419             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
420             if (attr.getName().equals("name")) { // <os name="???">
421
list.operatingSystems.add(attr.getValue());
422             }
423         }
424         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
425         for (int i = 0; i < nodes.getLength(); i++) {
426             org.w3c.dom.Node JavaDoc node = nodes.item(i);
427             switch (node.getNodeType()) {
428                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
429                     // ((org.w3c.dom.CDATASection)node).getData();
430
break;
431                 case org.w3c.dom.Node.ELEMENT_NODE:
432                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
433                     break;
434                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
435                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
436
// ((org.w3c.dom.ProcessingInstruction)node).getData();
437
break;
438             }
439         }
440     }
441     
442     /**
443      * Scan through org.w3c.dom.Element named versions.
444      */

445     void visitElement_versions(org.w3c.dom.Element JavaDoc element) { // <versions>
446
// element.getValue();
447
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
448         for (int i = 0; i < nodes.getLength(); i++) {
449             org.w3c.dom.Node JavaDoc node = nodes.item(i);
450             switch (node.getNodeType()) {
451                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
452                     // ((org.w3c.dom.CDATASection)node).getData();
453
break;
454                 case org.w3c.dom.Node.ELEMENT_NODE:
455                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
456                     if (nodeElement.getTagName().equals("version")) {
457                         visitElement_version(nodeElement);
458                     }
459                     break;
460                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
461                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
462
// ((org.w3c.dom.ProcessingInstruction)node).getData();
463
break;
464             }
465         }
466     }
467     
468     /**
469      * Scan through org.w3c.dom.Element named version.
470      */

471     void visitElement_version(org.w3c.dom.Element JavaDoc element) { // <version>
472
// element.getValue();
473
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
474         for (int i = 0; i < attrs.getLength(); i++) {
475             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
476             if (attr.getName().equals("name")) { // <version name="???">
477
list.versions.add(attr.getValue());
478             }
479         }
480         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
481         for (int i = 0; i < nodes.getLength(); i++) {
482             org.w3c.dom.Node JavaDoc node = nodes.item(i);
483             switch (node.getNodeType()) {
484                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
485                     // ((org.w3c.dom.CDATASection)node).getData();
486
break;
487                 case org.w3c.dom.Node.ELEMENT_NODE:
488                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
489                     break;
490                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
491                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
492
// ((org.w3c.dom.ProcessingInstruction)node).getData();
493
break;
494             }
495         }
496     }
497     
498     /**
499      * Scan through org.w3c.dom.Element named priorities.
500      */

501     void visitElement_priorities(org.w3c.dom.Element JavaDoc element) { // <priorities>
502
// element.getValue();
503
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
504         for (int i = 0; i < nodes.getLength(); i++) {
505             org.w3c.dom.Node JavaDoc node = nodes.item(i);
506             switch (node.getNodeType()) {
507                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
508                     // ((org.w3c.dom.CDATASection)node).getData();
509
break;
510                 case org.w3c.dom.Node.ELEMENT_NODE:
511                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
512                     if (nodeElement.getTagName().equals("priority")) {
513                         visitElement_priority(nodeElement);
514                     }
515                     break;
516                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
517                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
518
// ((org.w3c.dom.ProcessingInstruction)node).getData();
519
break;
520             }
521         }
522     }
523     
524     /**
525      * Scan through org.w3c.dom.Element named priority.
526      */

527     void visitElement_priority(org.w3c.dom.Element JavaDoc element) { // <priority>
528
// element.getValue();
529
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
530         for (int i = 0; i < attrs.getLength(); i++) {
531             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
532             if (attr.getName().equals("name")) { // <priority name="???">
533
list.priorities.add(attr.getValue());
534             }
535         }
536         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
537         for (int i = 0; i < nodes.getLength(); i++) {
538             org.w3c.dom.Node JavaDoc node = nodes.item(i);
539             switch (node.getNodeType()) {
540                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
541                     // ((org.w3c.dom.CDATASection)node).getData();
542
break;
543                 case org.w3c.dom.Node.ELEMENT_NODE:
544                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
545                     break;
546                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
547                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
548
// ((org.w3c.dom.ProcessingInstruction)node).getData();
549
break;
550             }
551         }
552     }
553     
554     /**
555      * Scan through org.w3c.dom.Element named issue-types.
556      */

557     void visitElement_issue_types(org.w3c.dom.Element JavaDoc element) { // <issue-types>
558
// element.getValue();
559
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
560         for (int i = 0; i < nodes.getLength(); i++) {
561             org.w3c.dom.Node JavaDoc node = nodes.item(i);
562             switch (node.getNodeType()) {
563                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
564                     // ((org.w3c.dom.CDATASection)node).getData();
565
break;
566                 case org.w3c.dom.Node.ELEMENT_NODE:
567                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
568                     if (nodeElement.getTagName().equals("issue-type")) {
569                         visitElement_issue_type(nodeElement);
570                     }
571                     break;
572                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
573                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
574
// ((org.w3c.dom.ProcessingInstruction)node).getData();
575
break;
576             }
577         }
578     }
579     
580     /**
581      * Scan through org.w3c.dom.Element named issue-type.
582      */

583     void visitElement_issue_type(org.w3c.dom.Element JavaDoc element) { // <issue-type>
584
// element.getValue();
585
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
586         for (int i = 0; i < attrs.getLength(); i++) {
587             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
588             if (attr.getName().equals("name")) { // <issue-type name="???">
589
list.issueTypes.add(attr.getValue());
590             }
591         }
592         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
593         for (int i = 0; i < nodes.getLength(); i++) {
594             org.w3c.dom.Node JavaDoc node = nodes.item(i);
595             switch (node.getNodeType()) {
596                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
597                     // ((org.w3c.dom.CDATASection)node).getData();
598
break;
599                 case org.w3c.dom.Node.ELEMENT_NODE:
600                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
601                     break;
602                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
603                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
604
// ((org.w3c.dom.ProcessingInstruction)node).getData();
605
break;
606             }
607         }
608     }
609     
610     /**
611      * Scan through org.w3c.dom.Element named persons.
612      */

613     void visitElement_persons(org.w3c.dom.Element JavaDoc element) { // <persons>
614
// element.getValue();
615
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
616         for (int i = 0; i < nodes.getLength(); i++) {
617             org.w3c.dom.Node JavaDoc node = nodes.item(i);
618             switch (node.getNodeType()) {
619                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
620                     // ((org.w3c.dom.CDATASection)node).getData();
621
break;
622                 case org.w3c.dom.Node.ELEMENT_NODE:
623                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
624                     if (nodeElement.getTagName().equals("person")) {
625                         visitElement_person(nodeElement);
626                     }
627                     break;
628                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
629                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
630
// ((org.w3c.dom.ProcessingInstruction)node).getData();
631
break;
632             }
633         }
634     }
635     
636     /**
637      * Scan through org.w3c.dom.Element named person.
638      */

639     void visitElement_person(org.w3c.dom.Element JavaDoc element) { // <person>
640
// element.getValue();
641
person = new Person();
642         list.persons.add(person);
643         org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
644         for (int i = 0; i < attrs.getLength(); i++) {
645             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
646             if (attr.getName().equals("first-name")) { // <person name="???">
647
person.firstName = attr.getValue();
648             }
649             if (attr.getName().equals("surname")) { // <person sirname="???">
650
person.surname = attr.getValue();
651             }
652             if (attr.getName().equals("email")) { // <person email="???">
653
person.email = attr.getValue();
654             }
655         }
656         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
657         for (int i = 0; i < nodes.getLength(); i++) {
658             org.w3c.dom.Node JavaDoc node = nodes.item(i);
659             switch (node.getNodeType()) {
660                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
661                     // ((org.w3c.dom.CDATASection)node).getData();
662
break;
663                 case org.w3c.dom.Node.ELEMENT_NODE:
664                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
665                     break;
666                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
667                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
668
// ((org.w3c.dom.ProcessingInstruction)node).getData();
669
break;
670             }
671         }
672     }
673     
674     /**
675      * Scan through org.w3c.dom.Element named resolutions.
676      */

677     void visitElement_resolutions(org.w3c.dom.Element JavaDoc element) { // <resolutions>
678
// element.getValue();
679
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
680         for (int i = 0; i < nodes.getLength(); i++) {
681             org.w3c.dom.Node JavaDoc node = nodes.item(i);
682             switch (node.getNodeType()) {
683                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
684                     // ((org.w3c.dom.CDATASection)node).getData();
685
break;
686                 case org.w3c.dom.Node.ELEMENT_NODE:
687                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
688                     if (nodeElement.getTagName().equals("resolution")) {
689                         visitElement_resolution(nodeElement);
690                     }
691                     break;
692                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
693                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
694
// ((org.w3c.dom.ProcessingInstruction)node).getData();
695
break;
696             }
697         }
698     }
699     
700     /**
701      * Scan through org.w3c.dom.Element named resolution.
702      */

703     void visitElement_resolution(org.w3c.dom.Element JavaDoc element) { // <resolution>
704
// element.getValue();
705
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
706         for (int i = 0; i < attrs.getLength(); i++) {
707             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
708             if (attr.getName().equals("name")) { // <resolution name="???">
709
list.resolutions.add(attr.getValue());
710             }
711         }
712         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
713         for (int i = 0; i < nodes.getLength(); i++) {
714             org.w3c.dom.Node JavaDoc node = nodes.item(i);
715             switch (node.getNodeType()) {
716                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
717                     // ((org.w3c.dom.CDATASection)node).getData();
718
break;
719                 case org.w3c.dom.Node.ELEMENT_NODE:
720                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
721                     break;
722                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
723                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
724
// ((org.w3c.dom.ProcessingInstruction)node).getData();
725
break;
726             }
727         }
728     }
729     
730     /**
731      * Scan through org.w3c.dom.Element named issue.
732      */

733     void visitElement_issue(org.w3c.dom.Element JavaDoc element) { // <issue>
734
// element.getValue();
735
issue = list.createIssue();
736         
737         // TODO: error handling for parseInt()
738
org.w3c.dom.NamedNodeMap JavaDoc attrs = element.getAttributes();
739         for (int i = 0; i < attrs.getLength(); i++) {
740             org.w3c.dom.Attr JavaDoc attr = (org.w3c.dom.Attr JavaDoc)attrs.item(i);
741             if (attr.getName().equals("id")) { // <issue id="???">
742
issue.id = Integer.parseInt(attr.getValue());
743             }
744             if (attr.getName().equals("component")) { // <issue component="???">
745
issue.component = Integer.parseInt(attr.getValue());
746             }
747             if (attr.getName().equals("subcomponent")) { // <issue subcomponent="???">
748
issue.subcomponent = Integer.parseInt(attr.getValue());
749             }
750             if (attr.getName().equals("status")) { // <issue status="???">
751
issue.status = Integer.parseInt(attr.getValue());
752             }
753             if (attr.getName().equals("platform")) { // <issue platform="???">
754
issue.platform = Integer.parseInt(attr.getValue());
755             }
756             if (attr.getName().equals("os")) { // <issue os="???">
757
issue.os = Integer.parseInt(attr.getValue());
758             }
759             if (attr.getName().equals("version")) { // <issue version="???">
760
issue.version = Integer.parseInt(attr.getValue());
761             }
762             if (attr.getName().equals("priority")) { // <issue priority="???">
763
issue.priority = Integer.parseInt(attr.getValue());
764             }
765             if (attr.getName().equals("issue-type")) { // <issue issue-type="???">
766
issue.type = Integer.parseInt(attr.getValue());
767             }
768             if (attr.getName().equals("target-version")) { // <issue target-version="???">
769
issue.targetVersion = Integer.parseInt(attr.getValue());
770             }
771             if (attr.getName().equals("assigned-to")) { // <issue assigned-to="???">
772
issue.assignedTo = Integer.parseInt(attr.getValue());
773             }
774             if (attr.getName().equals("url")) { // <issue url="???">
775
try {
776                     issue.url = new URL JavaDoc(attr.getValue());
777                 } catch (MalformedURLException JavaDoc e) {
778                     e.printStackTrace(); // TODO
779
}
780             }
781             if (attr.getName().equals("summary")) { // <issue summary="???">
782
issue.summary = attr.getValue();
783             }
784             if (attr.getName().equals("resolution")) { // <issue resolution="???">
785
issue.resolution = Integer.parseInt(attr.getValue());
786             }
787         }
788         org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
789         for (int i = 0; i < nodes.getLength(); i++) {
790             org.w3c.dom.Node JavaDoc node = nodes.item(i);
791             switch (node.getNodeType()) {
792                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
793                     // ((org.w3c.dom.CDATASection)node).getData();
794
break;
795                 case org.w3c.dom.Node.ELEMENT_NODE:
796                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
797                     if (nodeElement.getTagName().equals("depends-on")) {
798                         visitElement_depends_on(nodeElement);
799                     }
800                     if (nodeElement.getTagName().equals("comment")) {
801                         visitElement_comment(nodeElement);
802                     }
803                     break;
804                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
805                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
806
// ((org.w3c.dom.ProcessingInstruction)node).getData();
807
break;
808             }
809         }
810     }
811     
812     /**
813      * Scan through org.w3c.dom.Element named depends-on.
814      */

815     void visitElement_depends_on(org.w3c.dom.Element JavaDoc element) { // <depends-on>
816
// element.getValue();
817
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
818         for (int i = 0; i < nodes.getLength(); i++) {
819             org.w3c.dom.Node JavaDoc node = nodes.item(i);
820             switch (node.getNodeType()) {
821                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
822                     // ((org.w3c.dom.CDATASection)node).getData();
823
break;
824                 case org.w3c.dom.Node.ELEMENT_NODE:
825                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
826                     break;
827                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
828                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
829
// ((org.w3c.dom.ProcessingInstruction)node).getData();
830
break;
831                 case org.w3c.dom.Node.TEXT_NODE:
832                     issue.dependsOn.add(((org.w3c.dom.Text JavaDoc)node).getData());
833                     break;
834             }
835         }
836     }
837     
838     /**
839      * Scan through org.w3c.dom.Element named comment.
840      */

841     void visitElement_comment(org.w3c.dom.Element JavaDoc element) { // <comment>
842
// element.getValue();
843
org.w3c.dom.NodeList JavaDoc nodes = element.getChildNodes();
844         for (int i = 0; i < nodes.getLength(); i++) {
845             org.w3c.dom.Node JavaDoc node = nodes.item(i);
846             switch (node.getNodeType()) {
847                 case org.w3c.dom.Node.CDATA_SECTION_NODE:
848                     // ((org.w3c.dom.CDATASection)node).getData();
849
break;
850                 case org.w3c.dom.Node.ELEMENT_NODE:
851                     org.w3c.dom.Element JavaDoc nodeElement = (org.w3c.dom.Element JavaDoc)node;
852                     break;
853                 case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
854                     // ((org.w3c.dom.ProcessingInstruction)node).getTarget();
855
// ((org.w3c.dom.ProcessingInstruction)node).getData();
856
break;
857                 case org.w3c.dom.Node.TEXT_NODE:
858                     issue.comments.add(((org.w3c.dom.Text JavaDoc)node).getData());
859                     break;
860             }
861         }
862     }
863 }
864
Popular Tags