1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.apache.maven.plugins.changes.model.io.xpp3; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
import java.io.IOException; |
15 | |
import java.io.InputStream; |
16 | |
import java.io.Reader; |
17 | |
import java.text.DateFormat; |
18 | |
import java.util.Locale; |
19 | |
import org.apache.maven.plugins.changes.model.Action; |
20 | |
import org.apache.maven.plugins.changes.model.Author; |
21 | |
import org.apache.maven.plugins.changes.model.Body; |
22 | |
import org.apache.maven.plugins.changes.model.ChangesDocument; |
23 | |
import org.apache.maven.plugins.changes.model.Component; |
24 | |
import org.apache.maven.plugins.changes.model.DueTo; |
25 | |
import org.apache.maven.plugins.changes.model.FixedIssue; |
26 | |
import org.apache.maven.plugins.changes.model.Properties; |
27 | |
import org.apache.maven.plugins.changes.model.Release; |
28 | |
import org.codehaus.plexus.util.ReaderFactory; |
29 | |
import org.codehaus.plexus.util.xml.pull.MXParser; |
30 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParser; |
31 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 2 | public class ChangesXpp3Reader |
39 | |
{ |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | 2 | private boolean addDefaultEntities = true; |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed ) |
73 | |
throws XmlPullParserException |
74 | |
{ |
75 | 28 | if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) |
76 | |
{ |
77 | 20 | return false; |
78 | |
} |
79 | 8 | if ( parsed.contains( tagName ) ) |
80 | |
{ |
81 | 0 | throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); |
82 | |
} |
83 | 8 | parsed.add( tagName ); |
84 | 8 | return true; |
85 | |
} |
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
public boolean getAddDefaultEntities() |
93 | |
{ |
94 | 0 | return addDefaultEntities; |
95 | |
} |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser ) |
107 | |
throws XmlPullParserException |
108 | |
{ |
109 | 0 | return getBooleanValue( s, attribute, parser, null ); |
110 | |
} |
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue ) |
123 | |
throws XmlPullParserException |
124 | |
{ |
125 | 0 | if ( s != null && s.length() != 0 ) |
126 | |
{ |
127 | 0 | return Boolean.valueOf( s ).booleanValue(); |
128 | |
} |
129 | 0 | if ( defaultValue != null ) |
130 | |
{ |
131 | 0 | return Boolean.valueOf( defaultValue ).booleanValue(); |
132 | |
} |
133 | 0 | return false; |
134 | |
} |
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
147 | |
throws XmlPullParserException |
148 | |
{ |
149 | 0 | if ( s != null ) |
150 | |
{ |
151 | |
try |
152 | |
{ |
153 | 0 | return Byte.valueOf( s ).byteValue(); |
154 | |
} |
155 | 0 | catch ( NumberFormatException e ) |
156 | |
{ |
157 | 0 | if ( strict ) |
158 | |
{ |
159 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, null ); |
160 | |
} |
161 | |
} |
162 | |
} |
163 | 0 | return 0; |
164 | |
} |
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
private char getCharacterValue( String s, String attribute, XmlPullParser parser ) |
176 | |
throws XmlPullParserException |
177 | |
{ |
178 | 0 | if ( s != null ) |
179 | |
{ |
180 | 0 | return s.charAt( 0 ); |
181 | |
} |
182 | 0 | return 0; |
183 | |
} |
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser ) |
195 | |
throws XmlPullParserException |
196 | |
{ |
197 | 0 | return getDateValue( s, attribute, null, parser ); |
198 | |
} |
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | |
|
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser ) |
211 | |
throws XmlPullParserException |
212 | |
{ |
213 | 0 | if ( s != null ) |
214 | |
{ |
215 | 0 | String effectiveDateFormat = dateFormat; |
216 | 0 | if ( dateFormat == null ) |
217 | |
{ |
218 | 0 | effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; |
219 | |
} |
220 | 0 | if ( "long".equals( effectiveDateFormat ) ) |
221 | |
{ |
222 | |
try |
223 | |
{ |
224 | 0 | return new java.util.Date( Long.parseLong( s ) ); |
225 | |
} |
226 | 0 | catch ( NumberFormatException e ) |
227 | |
{ |
228 | 0 | throw new XmlPullParserException( e.getMessage() ); |
229 | |
} |
230 | |
} |
231 | |
else |
232 | |
{ |
233 | |
try |
234 | |
{ |
235 | 0 | DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US ); |
236 | 0 | return dateParser.parse( s ); |
237 | |
} |
238 | 0 | catch ( java.text.ParseException e ) |
239 | |
{ |
240 | 0 | throw new XmlPullParserException( e.getMessage() ); |
241 | |
} |
242 | |
} |
243 | |
} |
244 | 0 | return null; |
245 | |
} |
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
|
254 | |
|
255 | |
|
256 | |
|
257 | |
private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
258 | |
throws XmlPullParserException |
259 | |
{ |
260 | 0 | if ( s != null ) |
261 | |
{ |
262 | |
try |
263 | |
{ |
264 | 0 | return Double.valueOf( s ).doubleValue(); |
265 | |
} |
266 | 0 | catch ( NumberFormatException e ) |
267 | |
{ |
268 | 0 | if ( strict ) |
269 | |
{ |
270 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
271 | |
} |
272 | |
} |
273 | |
} |
274 | 0 | return 0; |
275 | |
} |
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
|
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
288 | |
throws XmlPullParserException |
289 | |
{ |
290 | 0 | if ( s != null ) |
291 | |
{ |
292 | |
try |
293 | |
{ |
294 | 0 | return Float.valueOf( s ).floatValue(); |
295 | |
} |
296 | 0 | catch ( NumberFormatException e ) |
297 | |
{ |
298 | 0 | if ( strict ) |
299 | |
{ |
300 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
301 | |
} |
302 | |
} |
303 | |
} |
304 | 0 | return 0; |
305 | |
} |
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
318 | |
throws XmlPullParserException |
319 | |
{ |
320 | 0 | if ( s != null ) |
321 | |
{ |
322 | |
try |
323 | |
{ |
324 | 0 | return Integer.valueOf( s ).intValue(); |
325 | |
} |
326 | 0 | catch ( NumberFormatException e ) |
327 | |
{ |
328 | 0 | if ( strict ) |
329 | |
{ |
330 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, null ); |
331 | |
} |
332 | |
} |
333 | |
} |
334 | 0 | return 0; |
335 | |
} |
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
|
341 | |
|
342 | |
|
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
348 | |
throws XmlPullParserException |
349 | |
{ |
350 | 0 | if ( s != null ) |
351 | |
{ |
352 | |
try |
353 | |
{ |
354 | 0 | return Long.valueOf( s ).longValue(); |
355 | |
} |
356 | 0 | catch ( NumberFormatException e ) |
357 | |
{ |
358 | 0 | if ( strict ) |
359 | |
{ |
360 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, null ); |
361 | |
} |
362 | |
} |
363 | |
} |
364 | 0 | return 0; |
365 | |
} |
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
|
371 | |
|
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | |
|
377 | |
private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
378 | |
throws XmlPullParserException |
379 | |
{ |
380 | 0 | if ( s == null ) |
381 | |
{ |
382 | 0 | if ( strict ) |
383 | |
{ |
384 | 0 | throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null ); |
385 | |
} |
386 | |
} |
387 | 0 | return s; |
388 | |
} |
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
401 | |
throws XmlPullParserException |
402 | |
{ |
403 | 0 | if ( s != null ) |
404 | |
{ |
405 | |
try |
406 | |
{ |
407 | 0 | return Short.valueOf( s ).shortValue(); |
408 | |
} |
409 | 0 | catch ( NumberFormatException e ) |
410 | |
{ |
411 | 0 | if ( strict ) |
412 | |
{ |
413 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, null ); |
414 | |
} |
415 | |
} |
416 | |
} |
417 | 0 | return 0; |
418 | |
} |
419 | |
|
420 | |
|
421 | |
|
422 | |
|
423 | |
|
424 | |
|
425 | |
|
426 | |
private String getTrimmedValue( String s ) |
427 | |
{ |
428 | 83 | if ( s != null ) |
429 | |
{ |
430 | 83 | s = s.trim(); |
431 | |
} |
432 | 83 | return s; |
433 | |
} |
434 | |
|
435 | |
|
436 | |
|
437 | |
|
438 | |
|
439 | |
|
440 | |
|
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
private Action parseAction( String tagName, XmlPullParser parser, boolean strict ) |
446 | |
throws IOException, XmlPullParserException |
447 | |
{ |
448 | 11 | Action action = new Action(); |
449 | 11 | if ( parser.getAttributeValue( "", "dev" ) != null ) |
450 | |
{ |
451 | 11 | action.setDev( getTrimmedValue( parser.getAttributeValue( "", "dev" ) ) ); |
452 | |
} |
453 | 11 | if ( parser.getAttributeValue( "", "due-to" ) != null ) |
454 | |
{ |
455 | 2 | action.setDueTo( getTrimmedValue( parser.getAttributeValue( "", "due-to" ) ) ); |
456 | |
} |
457 | 11 | if ( parser.getAttributeValue( "", "due-to-email" ) != null ) |
458 | |
{ |
459 | 2 | action.setDueToEmail( getTrimmedValue( parser.getAttributeValue( "", "due-to-email" ) ) ); |
460 | |
} |
461 | 11 | if ( parser.getAttributeValue( "", "issue" ) != null ) |
462 | |
{ |
463 | 4 | action.setIssue( getTrimmedValue( parser.getAttributeValue( "", "issue" ) ) ); |
464 | |
} |
465 | 11 | if ( parser.getAttributeValue( "", "type" ) != null ) |
466 | |
{ |
467 | 11 | action.setType( getTrimmedValue( parser.getAttributeValue( "", "type" ) ) ); |
468 | |
} |
469 | 11 | if ( parser.getAttributeValue( "", "system" ) != null ) |
470 | |
{ |
471 | 2 | action.setSystem( getTrimmedValue( parser.getAttributeValue( "", "system" ) ) ); |
472 | |
} |
473 | 11 | if ( parser.getAttributeValue( "", "date" ) != null ) |
474 | |
{ |
475 | 1 | action.setDate( getTrimmedValue( parser.getAttributeValue( "", "date" ) ) ); |
476 | |
} |
477 | 11 | parser.next(); |
478 | 11 | action.setAction( getTrimmedValue( parser.getText() ) ); |
479 | 11 | java.util.Set parsed = new java.util.HashSet(); |
480 | 27 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
481 | |
{ |
482 | 16 | if ( checkFieldWithDuplicate( parser, "action", null, parsed ) ) |
483 | |
{ |
484 | |
} |
485 | 16 | else if ( parser.getName().equals( "fixes" ) ) |
486 | |
{ |
487 | 7 | java.util.List fixedIssues = action.getFixedIssues(); |
488 | 7 | if ( fixedIssues == null ) |
489 | |
{ |
490 | 0 | fixedIssues = new java.util.ArrayList(); |
491 | 0 | action.setFixedIssues( fixedIssues ); |
492 | |
} |
493 | 7 | fixedIssues.add( parseFixedIssue( "fixes", parser, strict ) ); |
494 | 7 | } |
495 | 9 | else if ( parser.getName().equals( "dueto" ) ) |
496 | |
{ |
497 | 9 | java.util.List dueTos = action.getDueTos(); |
498 | 9 | if ( dueTos == null ) |
499 | |
{ |
500 | 0 | dueTos = new java.util.ArrayList(); |
501 | 0 | action.setDueTos( dueTos ); |
502 | |
} |
503 | 9 | dueTos.add( parseDueTo( "dueto", parser, strict ) ); |
504 | 9 | } |
505 | |
else |
506 | |
{ |
507 | 0 | if ( strict ) |
508 | |
{ |
509 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
510 | |
} |
511 | |
else |
512 | |
{ |
513 | |
|
514 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
515 | |
} |
516 | |
} |
517 | |
} |
518 | 11 | return action; |
519 | |
} |
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
|
525 | |
|
526 | |
|
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
private Author parseAuthor( String tagName, XmlPullParser parser, boolean strict ) |
532 | |
throws IOException, XmlPullParserException |
533 | |
{ |
534 | 2 | Author author = new Author(); |
535 | 2 | if ( parser.getAttributeValue( "", "email" ) != null ) |
536 | |
{ |
537 | 2 | author.setAuthorEmail( getTrimmedValue( parser.getAttributeValue( "", "email" ) ) ); |
538 | |
} |
539 | 2 | parser.next(); |
540 | 2 | author.setName( getTrimmedValue( parser.getText() ) ); |
541 | 2 | java.util.Set parsed = new java.util.HashSet(); |
542 | 2 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
543 | |
{ |
544 | 0 | if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) |
545 | |
{ |
546 | |
} |
547 | |
else |
548 | |
{ |
549 | 0 | if ( strict ) |
550 | |
{ |
551 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
552 | |
} |
553 | |
else |
554 | |
{ |
555 | |
|
556 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
557 | |
} |
558 | |
} |
559 | |
} |
560 | 2 | return author; |
561 | |
} |
562 | |
|
563 | |
|
564 | |
|
565 | |
|
566 | |
|
567 | |
|
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | |
|
573 | |
private Body parseBody( String tagName, XmlPullParser parser, boolean strict ) |
574 | |
throws IOException, XmlPullParserException |
575 | |
{ |
576 | 2 | Body body = new Body(); |
577 | 2 | java.util.Set parsed = new java.util.HashSet(); |
578 | 6 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
579 | |
{ |
580 | 4 | if ( parser.getName().equals( "release" ) ) |
581 | |
{ |
582 | 4 | java.util.List releases = body.getReleases(); |
583 | 4 | if ( releases == null ) |
584 | |
{ |
585 | 0 | releases = new java.util.ArrayList(); |
586 | 0 | body.setReleases( releases ); |
587 | |
} |
588 | 4 | releases.add( parseRelease( "release", parser, strict ) ); |
589 | 4 | } |
590 | |
else |
591 | |
{ |
592 | 0 | if ( strict ) |
593 | |
{ |
594 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
595 | |
} |
596 | |
else |
597 | |
{ |
598 | |
|
599 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
600 | |
} |
601 | |
} |
602 | |
} |
603 | 2 | return body; |
604 | |
} |
605 | |
|
606 | |
|
607 | |
|
608 | |
|
609 | |
|
610 | |
|
611 | |
|
612 | |
|
613 | |
|
614 | |
|
615 | |
|
616 | |
private ChangesDocument parseChangesDocument( String tagName, XmlPullParser parser, boolean strict ) |
617 | |
throws IOException, XmlPullParserException |
618 | |
{ |
619 | 2 | ChangesDocument changesDocument = new ChangesDocument(); |
620 | 2 | java.util.Set parsed = new java.util.HashSet(); |
621 | 2 | int eventType = parser.getEventType(); |
622 | 2 | boolean foundRoot = false; |
623 | 16 | while ( eventType != XmlPullParser.END_DOCUMENT ) |
624 | |
{ |
625 | 14 | if ( eventType == XmlPullParser.START_TAG ) |
626 | |
{ |
627 | 6 | if ( parser.getName().equals( tagName ) ) |
628 | |
{ |
629 | 2 | foundRoot = true; |
630 | |
} |
631 | 4 | else if ( strict && ! foundRoot ) |
632 | |
{ |
633 | 0 | throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null ); |
634 | |
} |
635 | 4 | else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) ) |
636 | |
{ |
637 | 2 | changesDocument.setProperties( parseProperties( "properties", parser, strict ) ); |
638 | |
} |
639 | 2 | else if ( checkFieldWithDuplicate( parser, "body", null, parsed ) ) |
640 | |
{ |
641 | 2 | changesDocument.setBody( parseBody( "body", parser, strict ) ); |
642 | |
} |
643 | 0 | else if ( strict ) |
644 | |
{ |
645 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
646 | |
} |
647 | |
} |
648 | 14 | eventType = parser.next(); |
649 | |
} |
650 | 2 | return changesDocument; |
651 | |
} |
652 | |
|
653 | |
|
654 | |
|
655 | |
|
656 | |
|
657 | |
|
658 | |
|
659 | |
|
660 | |
|
661 | |
|
662 | |
|
663 | |
private Component parseComponent( String tagName, XmlPullParser parser, boolean strict ) |
664 | |
throws IOException, XmlPullParserException |
665 | |
{ |
666 | 0 | Component component = new Component(); |
667 | 0 | java.util.Set parsed = new java.util.HashSet(); |
668 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
669 | |
{ |
670 | 0 | if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) |
671 | |
{ |
672 | 0 | component.setName( getTrimmedValue( parser.nextText() ) ); |
673 | |
} |
674 | 0 | else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) ) |
675 | |
{ |
676 | 0 | component.setDescription( getTrimmedValue( parser.nextText() ) ); |
677 | |
} |
678 | 0 | else if ( checkFieldWithDuplicate( parser, "actions", null, parsed ) ) |
679 | |
{ |
680 | 0 | java.util.List actions = new java.util.ArrayList(); |
681 | 0 | component.setActions( actions ); |
682 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
683 | |
{ |
684 | 0 | if ( parser.getName().equals( "action" ) ) |
685 | |
{ |
686 | 0 | actions.add( parseAction( "action", parser, strict ) ); |
687 | |
} |
688 | 0 | else if ( strict ) |
689 | |
{ |
690 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
691 | |
} |
692 | |
else |
693 | |
{ |
694 | |
|
695 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
696 | |
} |
697 | |
} |
698 | 0 | } |
699 | |
else |
700 | |
{ |
701 | 0 | if ( strict ) |
702 | |
{ |
703 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
704 | |
} |
705 | |
else |
706 | |
{ |
707 | |
|
708 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
709 | |
} |
710 | |
} |
711 | |
} |
712 | 0 | return component; |
713 | |
} |
714 | |
|
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
|
720 | |
|
721 | |
|
722 | |
|
723 | |
|
724 | |
|
725 | |
private DueTo parseDueTo( String tagName, XmlPullParser parser, boolean strict ) |
726 | |
throws IOException, XmlPullParserException |
727 | |
{ |
728 | 9 | DueTo dueTo = new DueTo(); |
729 | 9 | if ( parser.getAttributeValue( "", "name" ) != null ) |
730 | |
{ |
731 | 9 | dueTo.setName( getTrimmedValue( parser.getAttributeValue( "", "name" ) ) ); |
732 | |
} |
733 | 9 | if ( parser.getAttributeValue( "", "email" ) != null ) |
734 | |
{ |
735 | 5 | dueTo.setEmail( getTrimmedValue( parser.getAttributeValue( "", "email" ) ) ); |
736 | |
} |
737 | 9 | java.util.Set parsed = new java.util.HashSet(); |
738 | 9 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
739 | |
{ |
740 | 0 | if ( strict ) |
741 | |
{ |
742 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
743 | |
} |
744 | |
else |
745 | |
{ |
746 | |
|
747 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
748 | |
} |
749 | |
} |
750 | 9 | return dueTo; |
751 | |
} |
752 | |
|
753 | |
|
754 | |
|
755 | |
|
756 | |
|
757 | |
|
758 | |
|
759 | |
|
760 | |
|
761 | |
|
762 | |
|
763 | |
private FixedIssue parseFixedIssue( String tagName, XmlPullParser parser, boolean strict ) |
764 | |
throws IOException, XmlPullParserException |
765 | |
{ |
766 | 7 | FixedIssue fixedIssue = new FixedIssue(); |
767 | 7 | if ( parser.getAttributeValue( "", "issue" ) != null ) |
768 | |
{ |
769 | 7 | fixedIssue.setIssue( getTrimmedValue( parser.getAttributeValue( "", "issue" ) ) ); |
770 | |
} |
771 | 7 | java.util.Set parsed = new java.util.HashSet(); |
772 | 7 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
773 | |
{ |
774 | 0 | if ( strict ) |
775 | |
{ |
776 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
777 | |
} |
778 | |
else |
779 | |
{ |
780 | |
|
781 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
782 | |
} |
783 | |
} |
784 | 7 | return fixedIssue; |
785 | |
} |
786 | |
|
787 | |
|
788 | |
|
789 | |
|
790 | |
|
791 | |
|
792 | |
|
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
private Properties parseProperties( String tagName, XmlPullParser parser, boolean strict ) |
798 | |
throws IOException, XmlPullParserException |
799 | |
{ |
800 | 2 | Properties properties = new Properties(); |
801 | 2 | java.util.Set parsed = new java.util.HashSet(); |
802 | 6 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
803 | |
{ |
804 | 4 | if ( checkFieldWithDuplicate( parser, "title", null, parsed ) ) |
805 | |
{ |
806 | 2 | properties.setTitle( getTrimmedValue( parser.nextText() ) ); |
807 | |
} |
808 | 2 | else if ( checkFieldWithDuplicate( parser, "author", null, parsed ) ) |
809 | |
{ |
810 | 2 | properties.setAuthor( parseAuthor( "author", parser, strict ) ); |
811 | |
} |
812 | |
else |
813 | |
{ |
814 | 0 | if ( strict ) |
815 | |
{ |
816 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
817 | |
} |
818 | |
else |
819 | |
{ |
820 | |
|
821 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
822 | |
} |
823 | |
} |
824 | |
} |
825 | 2 | return properties; |
826 | |
} |
827 | |
|
828 | |
|
829 | |
|
830 | |
|
831 | |
|
832 | |
|
833 | |
|
834 | |
|
835 | |
|
836 | |
|
837 | |
|
838 | |
private Release parseRelease( String tagName, XmlPullParser parser, boolean strict ) |
839 | |
throws IOException, XmlPullParserException |
840 | |
{ |
841 | 4 | Release release = new Release(); |
842 | 4 | if ( parser.getAttributeValue( "", "version" ) != null ) |
843 | |
{ |
844 | 4 | release.setVersion( getTrimmedValue( parser.getAttributeValue( "", "version" ) ) ); |
845 | |
} |
846 | 4 | if ( parser.getAttributeValue( "", "date" ) != null ) |
847 | |
{ |
848 | 4 | release.setDateRelease( getTrimmedValue( parser.getAttributeValue( "", "date" ) ) ); |
849 | |
} |
850 | 4 | if ( parser.getAttributeValue( "", "description" ) != null ) |
851 | |
{ |
852 | 4 | release.setDescription( getTrimmedValue( parser.getAttributeValue( "", "description" ) ) ); |
853 | |
} |
854 | 4 | java.util.Set parsed = new java.util.HashSet(); |
855 | 15 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
856 | |
{ |
857 | 11 | if ( parser.getName().equals( "action" ) ) |
858 | |
{ |
859 | 11 | java.util.List actions = release.getActions(); |
860 | 11 | if ( actions == null ) |
861 | |
{ |
862 | 0 | actions = new java.util.ArrayList(); |
863 | 0 | release.setActions( actions ); |
864 | |
} |
865 | 11 | actions.add( parseAction( "action", parser, strict ) ); |
866 | 11 | } |
867 | |
else |
868 | |
{ |
869 | 0 | if ( strict ) |
870 | |
{ |
871 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
872 | |
} |
873 | |
else |
874 | |
{ |
875 | |
|
876 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
877 | |
} |
878 | |
} |
879 | |
} |
880 | 4 | return release; |
881 | |
} |
882 | |
|
883 | |
|
884 | |
|
885 | |
|
886 | |
|
887 | |
|
888 | |
|
889 | |
|
890 | |
|
891 | |
|
892 | |
public ChangesDocument read( Reader reader, boolean strict ) |
893 | |
throws IOException, XmlPullParserException |
894 | |
{ |
895 | 2 | XmlPullParser parser = new MXParser(); |
896 | |
|
897 | 2 | parser.setInput( reader ); |
898 | |
|
899 | 2 | if ( addDefaultEntities ) |
900 | |
{ |
901 | |
|
902 | |
|
903 | |
|
904 | |
|
905 | 2 | parser.defineEntityReplacementText( "nbsp", "\u00a0" ); |
906 | 2 | parser.defineEntityReplacementText( "iexcl", "\u00a1" ); |
907 | 2 | parser.defineEntityReplacementText( "cent", "\u00a2" ); |
908 | 2 | parser.defineEntityReplacementText( "pound", "\u00a3" ); |
909 | 2 | parser.defineEntityReplacementText( "curren", "\u00a4" ); |
910 | 2 | parser.defineEntityReplacementText( "yen", "\u00a5" ); |
911 | 2 | parser.defineEntityReplacementText( "brvbar", "\u00a6" ); |
912 | 2 | parser.defineEntityReplacementText( "sect", "\u00a7" ); |
913 | 2 | parser.defineEntityReplacementText( "uml", "\u00a8" ); |
914 | 2 | parser.defineEntityReplacementText( "copy", "\u00a9" ); |
915 | 2 | parser.defineEntityReplacementText( "ordf", "\u00aa" ); |
916 | 2 | parser.defineEntityReplacementText( "laquo", "\u00ab" ); |
917 | 2 | parser.defineEntityReplacementText( "not", "\u00ac" ); |
918 | 2 | parser.defineEntityReplacementText( "shy", "\u00ad" ); |
919 | 2 | parser.defineEntityReplacementText( "reg", "\u00ae" ); |
920 | 2 | parser.defineEntityReplacementText( "macr", "\u00af" ); |
921 | 2 | parser.defineEntityReplacementText( "deg", "\u00b0" ); |
922 | 2 | parser.defineEntityReplacementText( "plusmn", "\u00b1" ); |
923 | 2 | parser.defineEntityReplacementText( "sup2", "\u00b2" ); |
924 | 2 | parser.defineEntityReplacementText( "sup3", "\u00b3" ); |
925 | 2 | parser.defineEntityReplacementText( "acute", "\u00b4" ); |
926 | 2 | parser.defineEntityReplacementText( "micro", "\u00b5" ); |
927 | 2 | parser.defineEntityReplacementText( "para", "\u00b6" ); |
928 | 2 | parser.defineEntityReplacementText( "middot", "\u00b7" ); |
929 | 2 | parser.defineEntityReplacementText( "cedil", "\u00b8" ); |
930 | 2 | parser.defineEntityReplacementText( "sup1", "\u00b9" ); |
931 | 2 | parser.defineEntityReplacementText( "ordm", "\u00ba" ); |
932 | 2 | parser.defineEntityReplacementText( "raquo", "\u00bb" ); |
933 | 2 | parser.defineEntityReplacementText( "frac14", "\u00bc" ); |
934 | 2 | parser.defineEntityReplacementText( "frac12", "\u00bd" ); |
935 | 2 | parser.defineEntityReplacementText( "frac34", "\u00be" ); |
936 | 2 | parser.defineEntityReplacementText( "iquest", "\u00bf" ); |
937 | 2 | parser.defineEntityReplacementText( "Agrave", "\u00c0" ); |
938 | 2 | parser.defineEntityReplacementText( "Aacute", "\u00c1" ); |
939 | 2 | parser.defineEntityReplacementText( "Acirc", "\u00c2" ); |
940 | 2 | parser.defineEntityReplacementText( "Atilde", "\u00c3" ); |
941 | 2 | parser.defineEntityReplacementText( "Auml", "\u00c4" ); |
942 | 2 | parser.defineEntityReplacementText( "Aring", "\u00c5" ); |
943 | 2 | parser.defineEntityReplacementText( "AElig", "\u00c6" ); |
944 | 2 | parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); |
945 | 2 | parser.defineEntityReplacementText( "Egrave", "\u00c8" ); |
946 | 2 | parser.defineEntityReplacementText( "Eacute", "\u00c9" ); |
947 | 2 | parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); |
948 | 2 | parser.defineEntityReplacementText( "Euml", "\u00cb" ); |
949 | 2 | parser.defineEntityReplacementText( "Igrave", "\u00cc" ); |
950 | 2 | parser.defineEntityReplacementText( "Iacute", "\u00cd" ); |
951 | 2 | parser.defineEntityReplacementText( "Icirc", "\u00ce" ); |
952 | 2 | parser.defineEntityReplacementText( "Iuml", "\u00cf" ); |
953 | 2 | parser.defineEntityReplacementText( "ETH", "\u00d0" ); |
954 | 2 | parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); |
955 | 2 | parser.defineEntityReplacementText( "Ograve", "\u00d2" ); |
956 | 2 | parser.defineEntityReplacementText( "Oacute", "\u00d3" ); |
957 | 2 | parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); |
958 | 2 | parser.defineEntityReplacementText( "Otilde", "\u00d5" ); |
959 | 2 | parser.defineEntityReplacementText( "Ouml", "\u00d6" ); |
960 | 2 | parser.defineEntityReplacementText( "times", "\u00d7" ); |
961 | 2 | parser.defineEntityReplacementText( "Oslash", "\u00d8" ); |
962 | 2 | parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); |
963 | 2 | parser.defineEntityReplacementText( "Uacute", "\u00da" ); |
964 | 2 | parser.defineEntityReplacementText( "Ucirc", "\u00db" ); |
965 | 2 | parser.defineEntityReplacementText( "Uuml", "\u00dc" ); |
966 | 2 | parser.defineEntityReplacementText( "Yacute", "\u00dd" ); |
967 | 2 | parser.defineEntityReplacementText( "THORN", "\u00de" ); |
968 | 2 | parser.defineEntityReplacementText( "szlig", "\u00df" ); |
969 | 2 | parser.defineEntityReplacementText( "agrave", "\u00e0" ); |
970 | 2 | parser.defineEntityReplacementText( "aacute", "\u00e1" ); |
971 | 2 | parser.defineEntityReplacementText( "acirc", "\u00e2" ); |
972 | 2 | parser.defineEntityReplacementText( "atilde", "\u00e3" ); |
973 | 2 | parser.defineEntityReplacementText( "auml", "\u00e4" ); |
974 | 2 | parser.defineEntityReplacementText( "aring", "\u00e5" ); |
975 | 2 | parser.defineEntityReplacementText( "aelig", "\u00e6" ); |
976 | 2 | parser.defineEntityReplacementText( "ccedil", "\u00e7" ); |
977 | 2 | parser.defineEntityReplacementText( "egrave", "\u00e8" ); |
978 | 2 | parser.defineEntityReplacementText( "eacute", "\u00e9" ); |
979 | 2 | parser.defineEntityReplacementText( "ecirc", "\u00ea" ); |
980 | 2 | parser.defineEntityReplacementText( "euml", "\u00eb" ); |
981 | 2 | parser.defineEntityReplacementText( "igrave", "\u00ec" ); |
982 | 2 | parser.defineEntityReplacementText( "iacute", "\u00ed" ); |
983 | 2 | parser.defineEntityReplacementText( "icirc", "\u00ee" ); |
984 | 2 | parser.defineEntityReplacementText( "iuml", "\u00ef" ); |
985 | 2 | parser.defineEntityReplacementText( "eth", "\u00f0" ); |
986 | 2 | parser.defineEntityReplacementText( "ntilde", "\u00f1" ); |
987 | 2 | parser.defineEntityReplacementText( "ograve", "\u00f2" ); |
988 | 2 | parser.defineEntityReplacementText( "oacute", "\u00f3" ); |
989 | 2 | parser.defineEntityReplacementText( "ocirc", "\u00f4" ); |
990 | 2 | parser.defineEntityReplacementText( "otilde", "\u00f5" ); |
991 | 2 | parser.defineEntityReplacementText( "ouml", "\u00f6" ); |
992 | 2 | parser.defineEntityReplacementText( "divide", "\u00f7" ); |
993 | 2 | parser.defineEntityReplacementText( "oslash", "\u00f8" ); |
994 | 2 | parser.defineEntityReplacementText( "ugrave", "\u00f9" ); |
995 | 2 | parser.defineEntityReplacementText( "uacute", "\u00fa" ); |
996 | 2 | parser.defineEntityReplacementText( "ucirc", "\u00fb" ); |
997 | 2 | parser.defineEntityReplacementText( "uuml", "\u00fc" ); |
998 | 2 | parser.defineEntityReplacementText( "yacute", "\u00fd" ); |
999 | 2 | parser.defineEntityReplacementText( "thorn", "\u00fe" ); |
1000 | 2 | parser.defineEntityReplacementText( "yuml", "\u00ff" ); |
1001 | |
|
1002 | |
|
1003 | |
|
1004 | |
|
1005 | |
|
1006 | 2 | parser.defineEntityReplacementText( "OElig", "\u0152" ); |
1007 | 2 | parser.defineEntityReplacementText( "oelig", "\u0153" ); |
1008 | 2 | parser.defineEntityReplacementText( "Scaron", "\u0160" ); |
1009 | 2 | parser.defineEntityReplacementText( "scaron", "\u0161" ); |
1010 | 2 | parser.defineEntityReplacementText( "Yuml", "\u0178" ); |
1011 | 2 | parser.defineEntityReplacementText( "circ", "\u02c6" ); |
1012 | 2 | parser.defineEntityReplacementText( "tilde", "\u02dc" ); |
1013 | 2 | parser.defineEntityReplacementText( "ensp", "\u2002" ); |
1014 | 2 | parser.defineEntityReplacementText( "emsp", "\u2003" ); |
1015 | 2 | parser.defineEntityReplacementText( "thinsp", "\u2009" ); |
1016 | 2 | parser.defineEntityReplacementText( "zwnj", "\u200c" ); |
1017 | 2 | parser.defineEntityReplacementText( "zwj", "\u200d" ); |
1018 | 2 | parser.defineEntityReplacementText( "lrm", "\u200e" ); |
1019 | 2 | parser.defineEntityReplacementText( "rlm", "\u200f" ); |
1020 | 2 | parser.defineEntityReplacementText( "ndash", "\u2013" ); |
1021 | 2 | parser.defineEntityReplacementText( "mdash", "\u2014" ); |
1022 | 2 | parser.defineEntityReplacementText( "lsquo", "\u2018" ); |
1023 | 2 | parser.defineEntityReplacementText( "rsquo", "\u2019" ); |
1024 | 2 | parser.defineEntityReplacementText( "sbquo", "\u201a" ); |
1025 | 2 | parser.defineEntityReplacementText( "ldquo", "\u201c" ); |
1026 | 2 | parser.defineEntityReplacementText( "rdquo", "\u201d" ); |
1027 | 2 | parser.defineEntityReplacementText( "bdquo", "\u201e" ); |
1028 | 2 | parser.defineEntityReplacementText( "dagger", "\u2020" ); |
1029 | 2 | parser.defineEntityReplacementText( "Dagger", "\u2021" ); |
1030 | 2 | parser.defineEntityReplacementText( "permil", "\u2030" ); |
1031 | 2 | parser.defineEntityReplacementText( "lsaquo", "\u2039" ); |
1032 | 2 | parser.defineEntityReplacementText( "rsaquo", "\u203a" ); |
1033 | 2 | parser.defineEntityReplacementText( "euro", "\u20ac" ); |
1034 | |
|
1035 | |
|
1036 | |
|
1037 | |
|
1038 | |
|
1039 | 2 | parser.defineEntityReplacementText( "fnof", "\u0192" ); |
1040 | 2 | parser.defineEntityReplacementText( "Alpha", "\u0391" ); |
1041 | 2 | parser.defineEntityReplacementText( "Beta", "\u0392" ); |
1042 | 2 | parser.defineEntityReplacementText( "Gamma", "\u0393" ); |
1043 | 2 | parser.defineEntityReplacementText( "Delta", "\u0394" ); |
1044 | 2 | parser.defineEntityReplacementText( "Epsilon", "\u0395" ); |
1045 | 2 | parser.defineEntityReplacementText( "Zeta", "\u0396" ); |
1046 | 2 | parser.defineEntityReplacementText( "Eta", "\u0397" ); |
1047 | 2 | parser.defineEntityReplacementText( "Theta", "\u0398" ); |
1048 | 2 | parser.defineEntityReplacementText( "Iota", "\u0399" ); |
1049 | 2 | parser.defineEntityReplacementText( "Kappa", "\u039a" ); |
1050 | 2 | parser.defineEntityReplacementText( "Lambda", "\u039b" ); |
1051 | 2 | parser.defineEntityReplacementText( "Mu", "\u039c" ); |
1052 | 2 | parser.defineEntityReplacementText( "Nu", "\u039d" ); |
1053 | 2 | parser.defineEntityReplacementText( "Xi", "\u039e" ); |
1054 | 2 | parser.defineEntityReplacementText( "Omicron", "\u039f" ); |
1055 | 2 | parser.defineEntityReplacementText( "Pi", "\u03a0" ); |
1056 | 2 | parser.defineEntityReplacementText( "Rho", "\u03a1" ); |
1057 | 2 | parser.defineEntityReplacementText( "Sigma", "\u03a3" ); |
1058 | 2 | parser.defineEntityReplacementText( "Tau", "\u03a4" ); |
1059 | 2 | parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); |
1060 | 2 | parser.defineEntityReplacementText( "Phi", "\u03a6" ); |
1061 | 2 | parser.defineEntityReplacementText( "Chi", "\u03a7" ); |
1062 | 2 | parser.defineEntityReplacementText( "Psi", "\u03a8" ); |
1063 | 2 | parser.defineEntityReplacementText( "Omega", "\u03a9" ); |
1064 | 2 | parser.defineEntityReplacementText( "alpha", "\u03b1" ); |
1065 | 2 | parser.defineEntityReplacementText( "beta", "\u03b2" ); |
1066 | 2 | parser.defineEntityReplacementText( "gamma", "\u03b3" ); |
1067 | 2 | parser.defineEntityReplacementText( "delta", "\u03b4" ); |
1068 | 2 | parser.defineEntityReplacementText( "epsilon", "\u03b5" ); |
1069 | 2 | parser.defineEntityReplacementText( "zeta", "\u03b6" ); |
1070 | 2 | parser.defineEntityReplacementText( "eta", "\u03b7" ); |
1071 | 2 | parser.defineEntityReplacementText( "theta", "\u03b8" ); |
1072 | 2 | parser.defineEntityReplacementText( "iota", "\u03b9" ); |
1073 | 2 | parser.defineEntityReplacementText( "kappa", "\u03ba" ); |
1074 | 2 | parser.defineEntityReplacementText( "lambda", "\u03bb" ); |
1075 | 2 | parser.defineEntityReplacementText( "mu", "\u03bc" ); |
1076 | 2 | parser.defineEntityReplacementText( "nu", "\u03bd" ); |
1077 | 2 | parser.defineEntityReplacementText( "xi", "\u03be" ); |
1078 | 2 | parser.defineEntityReplacementText( "omicron", "\u03bf" ); |
1079 | 2 | parser.defineEntityReplacementText( "pi", "\u03c0" ); |
1080 | 2 | parser.defineEntityReplacementText( "rho", "\u03c1" ); |
1081 | 2 | parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); |
1082 | 2 | parser.defineEntityReplacementText( "sigma", "\u03c3" ); |
1083 | 2 | parser.defineEntityReplacementText( "tau", "\u03c4" ); |
1084 | 2 | parser.defineEntityReplacementText( "upsilon", "\u03c5" ); |
1085 | 2 | parser.defineEntityReplacementText( "phi", "\u03c6" ); |
1086 | 2 | parser.defineEntityReplacementText( "chi", "\u03c7" ); |
1087 | 2 | parser.defineEntityReplacementText( "psi", "\u03c8" ); |
1088 | 2 | parser.defineEntityReplacementText( "omega", "\u03c9" ); |
1089 | 2 | parser.defineEntityReplacementText( "thetasym", "\u03d1" ); |
1090 | 2 | parser.defineEntityReplacementText( "upsih", "\u03d2" ); |
1091 | 2 | parser.defineEntityReplacementText( "piv", "\u03d6" ); |
1092 | 2 | parser.defineEntityReplacementText( "bull", "\u2022" ); |
1093 | 2 | parser.defineEntityReplacementText( "hellip", "\u2026" ); |
1094 | 2 | parser.defineEntityReplacementText( "prime", "\u2032" ); |
1095 | 2 | parser.defineEntityReplacementText( "Prime", "\u2033" ); |
1096 | 2 | parser.defineEntityReplacementText( "oline", "\u203e" ); |
1097 | 2 | parser.defineEntityReplacementText( "frasl", "\u2044" ); |
1098 | 2 | parser.defineEntityReplacementText( "weierp", "\u2118" ); |
1099 | 2 | parser.defineEntityReplacementText( "image", "\u2111" ); |
1100 | 2 | parser.defineEntityReplacementText( "real", "\u211c" ); |
1101 | 2 | parser.defineEntityReplacementText( "trade", "\u2122" ); |
1102 | 2 | parser.defineEntityReplacementText( "alefsym", "\u2135" ); |
1103 | 2 | parser.defineEntityReplacementText( "larr", "\u2190" ); |
1104 | 2 | parser.defineEntityReplacementText( "uarr", "\u2191" ); |
1105 | 2 | parser.defineEntityReplacementText( "rarr", "\u2192" ); |
1106 | 2 | parser.defineEntityReplacementText( "darr", "\u2193" ); |
1107 | 2 | parser.defineEntityReplacementText( "harr", "\u2194" ); |
1108 | 2 | parser.defineEntityReplacementText( "crarr", "\u21b5" ); |
1109 | 2 | parser.defineEntityReplacementText( "lArr", "\u21d0" ); |
1110 | 2 | parser.defineEntityReplacementText( "uArr", "\u21d1" ); |
1111 | 2 | parser.defineEntityReplacementText( "rArr", "\u21d2" ); |
1112 | 2 | parser.defineEntityReplacementText( "dArr", "\u21d3" ); |
1113 | 2 | parser.defineEntityReplacementText( "hArr", "\u21d4" ); |
1114 | 2 | parser.defineEntityReplacementText( "forall", "\u2200" ); |
1115 | 2 | parser.defineEntityReplacementText( "part", "\u2202" ); |
1116 | 2 | parser.defineEntityReplacementText( "exist", "\u2203" ); |
1117 | 2 | parser.defineEntityReplacementText( "empty", "\u2205" ); |
1118 | 2 | parser.defineEntityReplacementText( "nabla", "\u2207" ); |
1119 | 2 | parser.defineEntityReplacementText( "isin", "\u2208" ); |
1120 | 2 | parser.defineEntityReplacementText( "notin", "\u2209" ); |
1121 | 2 | parser.defineEntityReplacementText( "ni", "\u220b" ); |
1122 | 2 | parser.defineEntityReplacementText( "prod", "\u220f" ); |
1123 | 2 | parser.defineEntityReplacementText( "sum", "\u2211" ); |
1124 | 2 | parser.defineEntityReplacementText( "minus", "\u2212" ); |
1125 | 2 | parser.defineEntityReplacementText( "lowast", "\u2217" ); |
1126 | 2 | parser.defineEntityReplacementText( "radic", "\u221a" ); |
1127 | 2 | parser.defineEntityReplacementText( "prop", "\u221d" ); |
1128 | 2 | parser.defineEntityReplacementText( "infin", "\u221e" ); |
1129 | 2 | parser.defineEntityReplacementText( "ang", "\u2220" ); |
1130 | 2 | parser.defineEntityReplacementText( "and", "\u2227" ); |
1131 | 2 | parser.defineEntityReplacementText( "or", "\u2228" ); |
1132 | 2 | parser.defineEntityReplacementText( "cap", "\u2229" ); |
1133 | 2 | parser.defineEntityReplacementText( "cup", "\u222a" ); |
1134 | 2 | parser.defineEntityReplacementText( "int", "\u222b" ); |
1135 | 2 | parser.defineEntityReplacementText( "there4", "\u2234" ); |
1136 | 2 | parser.defineEntityReplacementText( "sim", "\u223c" ); |
1137 | 2 | parser.defineEntityReplacementText( "cong", "\u2245" ); |
1138 | 2 | parser.defineEntityReplacementText( "asymp", "\u2248" ); |
1139 | 2 | parser.defineEntityReplacementText( "ne", "\u2260" ); |
1140 | 2 | parser.defineEntityReplacementText( "equiv", "\u2261" ); |
1141 | 2 | parser.defineEntityReplacementText( "le", "\u2264" ); |
1142 | 2 | parser.defineEntityReplacementText( "ge", "\u2265" ); |
1143 | 2 | parser.defineEntityReplacementText( "sub", "\u2282" ); |
1144 | 2 | parser.defineEntityReplacementText( "sup", "\u2283" ); |
1145 | 2 | parser.defineEntityReplacementText( "nsub", "\u2284" ); |
1146 | 2 | parser.defineEntityReplacementText( "sube", "\u2286" ); |
1147 | 2 | parser.defineEntityReplacementText( "supe", "\u2287" ); |
1148 | 2 | parser.defineEntityReplacementText( "oplus", "\u2295" ); |
1149 | 2 | parser.defineEntityReplacementText( "otimes", "\u2297" ); |
1150 | 2 | parser.defineEntityReplacementText( "perp", "\u22a5" ); |
1151 | 2 | parser.defineEntityReplacementText( "sdot", "\u22c5" ); |
1152 | 2 | parser.defineEntityReplacementText( "lceil", "\u2308" ); |
1153 | 2 | parser.defineEntityReplacementText( "rceil", "\u2309" ); |
1154 | 2 | parser.defineEntityReplacementText( "lfloor", "\u230a" ); |
1155 | 2 | parser.defineEntityReplacementText( "rfloor", "\u230b" ); |
1156 | 2 | parser.defineEntityReplacementText( "lang", "\u2329" ); |
1157 | 2 | parser.defineEntityReplacementText( "rang", "\u232a" ); |
1158 | 2 | parser.defineEntityReplacementText( "loz", "\u25ca" ); |
1159 | 2 | parser.defineEntityReplacementText( "spades", "\u2660" ); |
1160 | 2 | parser.defineEntityReplacementText( "clubs", "\u2663" ); |
1161 | 2 | parser.defineEntityReplacementText( "hearts", "\u2665" ); |
1162 | 2 | parser.defineEntityReplacementText( "diams", "\u2666" ); |
1163 | |
|
1164 | |
} |
1165 | |
|
1166 | 2 | parser.next(); |
1167 | 2 | return parseChangesDocument( "document", parser, strict ); |
1168 | |
} |
1169 | |
|
1170 | |
|
1171 | |
|
1172 | |
|
1173 | |
|
1174 | |
|
1175 | |
|
1176 | |
|
1177 | |
|
1178 | |
public ChangesDocument read( Reader reader ) |
1179 | |
throws IOException, XmlPullParserException |
1180 | |
{ |
1181 | 0 | return read( reader, true ); |
1182 | |
} |
1183 | |
|
1184 | |
|
1185 | |
|
1186 | |
|
1187 | |
|
1188 | |
|
1189 | |
|
1190 | |
|
1191 | |
|
1192 | |
|
1193 | |
public ChangesDocument read( InputStream in, boolean strict ) |
1194 | |
throws IOException, XmlPullParserException |
1195 | |
{ |
1196 | 2 | Reader reader = ReaderFactory.newXmlReader( in ); |
1197 | |
|
1198 | 2 | return read( reader, strict ); |
1199 | |
} |
1200 | |
|
1201 | |
|
1202 | |
|
1203 | |
|
1204 | |
|
1205 | |
|
1206 | |
|
1207 | |
|
1208 | |
|
1209 | |
public ChangesDocument read( InputStream in ) |
1210 | |
throws IOException, XmlPullParserException |
1211 | |
{ |
1212 | 0 | Reader reader = ReaderFactory.newXmlReader( in ); |
1213 | |
|
1214 | 0 | return read( reader ); |
1215 | |
} |
1216 | |
|
1217 | |
|
1218 | |
|
1219 | |
|
1220 | |
|
1221 | |
|
1222 | |
public void setAddDefaultEntities( boolean addDefaultEntities ) |
1223 | |
{ |
1224 | 0 | this.addDefaultEntities = addDefaultEntities; |
1225 | 0 | } |
1226 | |
|
1227 | |
|
1228 | |
} |