1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.apache.maven.doxia.linkcheck.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.doxia.linkcheck.model.LinkcheckFile; |
20 | |
import org.apache.maven.doxia.linkcheck.model.LinkcheckFileResult; |
21 | |
import org.apache.maven.doxia.linkcheck.model.LinkcheckModel; |
22 | |
import org.codehaus.plexus.util.ReaderFactory; |
23 | |
import org.codehaus.plexus.util.xml.pull.MXParser; |
24 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParser; |
25 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | 0 | public class LinkcheckModelXpp3Reader |
33 | |
{ |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | 0 | private boolean addDefaultEntities = true; |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed ) |
67 | |
throws XmlPullParserException |
68 | |
{ |
69 | 0 | if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) |
70 | |
{ |
71 | 0 | return false; |
72 | |
} |
73 | 0 | if ( parsed.contains( tagName ) ) |
74 | |
{ |
75 | 0 | throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); |
76 | |
} |
77 | 0 | parsed.add( tagName ); |
78 | 0 | return true; |
79 | |
} |
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
public boolean getAddDefaultEntities() |
87 | |
{ |
88 | 0 | return addDefaultEntities; |
89 | |
} |
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser ) |
101 | |
throws XmlPullParserException |
102 | |
{ |
103 | 0 | return getBooleanValue( s, attribute, parser, null ); |
104 | |
} |
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue ) |
117 | |
throws XmlPullParserException |
118 | |
{ |
119 | 0 | if ( s != null && s.length() != 0 ) |
120 | |
{ |
121 | 0 | return Boolean.valueOf( s ).booleanValue(); |
122 | |
} |
123 | 0 | if ( defaultValue != null ) |
124 | |
{ |
125 | 0 | return Boolean.valueOf( defaultValue ).booleanValue(); |
126 | |
} |
127 | 0 | return false; |
128 | |
} |
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
141 | |
throws XmlPullParserException |
142 | |
{ |
143 | 0 | if ( s != null ) |
144 | |
{ |
145 | |
try |
146 | |
{ |
147 | 0 | return Byte.valueOf( s ).byteValue(); |
148 | |
} |
149 | 0 | catch ( NumberFormatException e ) |
150 | |
{ |
151 | 0 | if ( strict ) |
152 | |
{ |
153 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, null ); |
154 | |
} |
155 | |
} |
156 | |
} |
157 | 0 | return 0; |
158 | |
} |
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
private char getCharacterValue( String s, String attribute, XmlPullParser parser ) |
170 | |
throws XmlPullParserException |
171 | |
{ |
172 | 0 | if ( s != null ) |
173 | |
{ |
174 | 0 | return s.charAt( 0 ); |
175 | |
} |
176 | 0 | return 0; |
177 | |
} |
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser ) |
189 | |
throws XmlPullParserException |
190 | |
{ |
191 | 0 | return getDateValue( s, attribute, null, parser ); |
192 | |
} |
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | |
private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser ) |
205 | |
throws XmlPullParserException |
206 | |
{ |
207 | 0 | if ( s != null ) |
208 | |
{ |
209 | 0 | String effectiveDateFormat = dateFormat; |
210 | 0 | if ( dateFormat == null ) |
211 | |
{ |
212 | 0 | effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; |
213 | |
} |
214 | 0 | if ( "long".equals( effectiveDateFormat ) ) |
215 | |
{ |
216 | |
try |
217 | |
{ |
218 | 0 | return new java.util.Date( Long.parseLong( s ) ); |
219 | |
} |
220 | 0 | catch ( NumberFormatException e ) |
221 | |
{ |
222 | 0 | throw new XmlPullParserException( e.getMessage() ); |
223 | |
} |
224 | |
} |
225 | |
else |
226 | |
{ |
227 | |
try |
228 | |
{ |
229 | 0 | DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US ); |
230 | 0 | return dateParser.parse( s ); |
231 | |
} |
232 | 0 | catch ( java.text.ParseException e ) |
233 | |
{ |
234 | 0 | throw new XmlPullParserException( e.getMessage() ); |
235 | |
} |
236 | |
} |
237 | |
} |
238 | 0 | return null; |
239 | |
} |
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
252 | |
throws XmlPullParserException |
253 | |
{ |
254 | 0 | if ( s != null ) |
255 | |
{ |
256 | |
try |
257 | |
{ |
258 | 0 | return Double.valueOf( s ).doubleValue(); |
259 | |
} |
260 | 0 | catch ( NumberFormatException e ) |
261 | |
{ |
262 | 0 | if ( strict ) |
263 | |
{ |
264 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
265 | |
} |
266 | |
} |
267 | |
} |
268 | 0 | return 0; |
269 | |
} |
270 | |
|
271 | |
|
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
|
281 | |
private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
282 | |
throws XmlPullParserException |
283 | |
{ |
284 | 0 | if ( s != null ) |
285 | |
{ |
286 | |
try |
287 | |
{ |
288 | 0 | return Float.valueOf( s ).floatValue(); |
289 | |
} |
290 | 0 | catch ( NumberFormatException e ) |
291 | |
{ |
292 | 0 | if ( strict ) |
293 | |
{ |
294 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
295 | |
} |
296 | |
} |
297 | |
} |
298 | 0 | return 0; |
299 | |
} |
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
312 | |
throws XmlPullParserException |
313 | |
{ |
314 | 0 | if ( s != null ) |
315 | |
{ |
316 | |
try |
317 | |
{ |
318 | 0 | return Integer.valueOf( s ).intValue(); |
319 | |
} |
320 | 0 | catch ( NumberFormatException e ) |
321 | |
{ |
322 | 0 | if ( strict ) |
323 | |
{ |
324 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, null ); |
325 | |
} |
326 | |
} |
327 | |
} |
328 | 0 | return 0; |
329 | |
} |
330 | |
|
331 | |
|
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
|
341 | |
private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
342 | |
throws XmlPullParserException |
343 | |
{ |
344 | 0 | if ( s != null ) |
345 | |
{ |
346 | |
try |
347 | |
{ |
348 | 0 | return Long.valueOf( s ).longValue(); |
349 | |
} |
350 | 0 | catch ( NumberFormatException e ) |
351 | |
{ |
352 | 0 | if ( strict ) |
353 | |
{ |
354 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, null ); |
355 | |
} |
356 | |
} |
357 | |
} |
358 | 0 | return 0; |
359 | |
} |
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
|
371 | |
private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
372 | |
throws XmlPullParserException |
373 | |
{ |
374 | 0 | if ( s == null ) |
375 | |
{ |
376 | 0 | if ( strict ) |
377 | |
{ |
378 | 0 | throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null ); |
379 | |
} |
380 | |
} |
381 | 0 | return s; |
382 | |
} |
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
|
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
395 | |
throws XmlPullParserException |
396 | |
{ |
397 | 0 | if ( s != null ) |
398 | |
{ |
399 | |
try |
400 | |
{ |
401 | 0 | return Short.valueOf( s ).shortValue(); |
402 | |
} |
403 | 0 | catch ( NumberFormatException e ) |
404 | |
{ |
405 | 0 | if ( strict ) |
406 | |
{ |
407 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, null ); |
408 | |
} |
409 | |
} |
410 | |
} |
411 | 0 | return 0; |
412 | |
} |
413 | |
|
414 | |
|
415 | |
|
416 | |
|
417 | |
|
418 | |
|
419 | |
|
420 | |
private String getTrimmedValue( String s ) |
421 | |
{ |
422 | 0 | if ( s != null ) |
423 | |
{ |
424 | 0 | s = s.trim(); |
425 | |
} |
426 | 0 | return s; |
427 | |
} |
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
|
438 | |
|
439 | |
private LinkcheckFile parseLinkcheckFile( String tagName, XmlPullParser parser, boolean strict ) |
440 | |
throws IOException, XmlPullParserException |
441 | |
{ |
442 | 0 | LinkcheckFile linkcheckFile = new LinkcheckFile(); |
443 | 0 | java.util.Set parsed = new java.util.HashSet(); |
444 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
445 | |
{ |
446 | 0 | if ( checkFieldWithDuplicate( parser, "absolutePath", null, parsed ) ) |
447 | |
{ |
448 | 0 | linkcheckFile.setAbsolutePath( getTrimmedValue( parser.nextText() ) ); |
449 | |
} |
450 | 0 | else if ( checkFieldWithDuplicate( parser, "relativePath", null, parsed ) ) |
451 | |
{ |
452 | 0 | linkcheckFile.setRelativePath( getTrimmedValue( parser.nextText() ) ); |
453 | |
} |
454 | 0 | else if ( checkFieldWithDuplicate( parser, "successful", null, parsed ) ) |
455 | |
{ |
456 | 0 | linkcheckFile.setSuccessful( getIntegerValue( getTrimmedValue( parser.nextText() ), "successful", parser, strict ) ); |
457 | |
} |
458 | 0 | else if ( checkFieldWithDuplicate( parser, "unsuccessful", null, parsed ) ) |
459 | |
{ |
460 | 0 | linkcheckFile.setUnsuccessful( getIntegerValue( getTrimmedValue( parser.nextText() ), "unsuccessful", parser, strict ) ); |
461 | |
} |
462 | 0 | else if ( checkFieldWithDuplicate( parser, "results", null, parsed ) ) |
463 | |
{ |
464 | 0 | java.util.List results = new java.util.ArrayList(); |
465 | 0 | linkcheckFile.setResults( results ); |
466 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
467 | |
{ |
468 | 0 | if ( parser.getName().equals( "result" ) ) |
469 | |
{ |
470 | 0 | results.add( parseLinkcheckFileResult( "result", parser, strict ) ); |
471 | |
} |
472 | 0 | else if ( strict ) |
473 | |
{ |
474 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
475 | |
} |
476 | |
else |
477 | |
{ |
478 | |
|
479 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
480 | |
} |
481 | |
} |
482 | 0 | } |
483 | |
else |
484 | |
{ |
485 | 0 | if ( strict ) |
486 | |
{ |
487 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
488 | |
} |
489 | |
else |
490 | |
{ |
491 | |
|
492 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
493 | |
} |
494 | |
} |
495 | |
} |
496 | 0 | return linkcheckFile; |
497 | |
} |
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | |
|
504 | |
|
505 | |
|
506 | |
|
507 | |
|
508 | |
|
509 | |
private LinkcheckFileResult parseLinkcheckFileResult( String tagName, XmlPullParser parser, boolean strict ) |
510 | |
throws IOException, XmlPullParserException |
511 | |
{ |
512 | 0 | LinkcheckFileResult linkcheckFileResult = new LinkcheckFileResult(); |
513 | 0 | java.util.Set parsed = new java.util.HashSet(); |
514 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
515 | |
{ |
516 | 0 | if ( checkFieldWithDuplicate( parser, "target", null, parsed ) ) |
517 | |
{ |
518 | 0 | linkcheckFileResult.setTarget( getTrimmedValue( parser.nextText() ) ); |
519 | |
} |
520 | 0 | else if ( checkFieldWithDuplicate( parser, "status", null, parsed ) ) |
521 | |
{ |
522 | 0 | linkcheckFileResult.setStatus( getTrimmedValue( parser.nextText() ) ); |
523 | |
} |
524 | 0 | else if ( checkFieldWithDuplicate( parser, "errorMessage", null, parsed ) ) |
525 | |
{ |
526 | 0 | linkcheckFileResult.setErrorMessage( getTrimmedValue( parser.nextText() ) ); |
527 | |
} |
528 | |
else |
529 | |
{ |
530 | 0 | if ( strict ) |
531 | |
{ |
532 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
533 | |
} |
534 | |
else |
535 | |
{ |
536 | |
|
537 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
538 | |
} |
539 | |
} |
540 | |
} |
541 | 0 | return linkcheckFileResult; |
542 | |
} |
543 | |
|
544 | |
|
545 | |
|
546 | |
|
547 | |
|
548 | |
|
549 | |
|
550 | |
|
551 | |
|
552 | |
|
553 | |
|
554 | |
private LinkcheckModel parseLinkcheckModel( String tagName, XmlPullParser parser, boolean strict ) |
555 | |
throws IOException, XmlPullParserException |
556 | |
{ |
557 | 0 | LinkcheckModel linkcheckModel = new LinkcheckModel(); |
558 | 0 | java.util.Set parsed = new java.util.HashSet(); |
559 | 0 | int eventType = parser.getEventType(); |
560 | 0 | boolean foundRoot = false; |
561 | 0 | linkcheckModel.setModelEncoding( parser.getInputEncoding() ); |
562 | 0 | while ( eventType != XmlPullParser.END_DOCUMENT ) |
563 | |
{ |
564 | 0 | if ( eventType == XmlPullParser.START_TAG ) |
565 | |
{ |
566 | 0 | if ( parser.getName().equals( tagName ) ) |
567 | |
{ |
568 | 0 | foundRoot = true; |
569 | |
} |
570 | 0 | else if ( strict && ! foundRoot ) |
571 | |
{ |
572 | 0 | throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null ); |
573 | |
} |
574 | 0 | else if ( checkFieldWithDuplicate( parser, "files", null, parsed ) ) |
575 | |
{ |
576 | 0 | java.util.List files = new java.util.ArrayList(); |
577 | 0 | linkcheckModel.setFiles( files ); |
578 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
579 | |
{ |
580 | 0 | if ( parser.getName().equals( "file" ) ) |
581 | |
{ |
582 | 0 | files.add( parseLinkcheckFile( "file", parser, strict ) ); |
583 | |
} |
584 | 0 | else if ( strict ) |
585 | |
{ |
586 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
587 | |
} |
588 | |
else |
589 | |
{ |
590 | |
|
591 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
592 | |
} |
593 | |
} |
594 | 0 | } |
595 | 0 | else if ( strict ) |
596 | |
{ |
597 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
598 | |
} |
599 | |
} |
600 | 0 | eventType = parser.next(); |
601 | |
} |
602 | 0 | return linkcheckModel; |
603 | |
} |
604 | |
|
605 | |
|
606 | |
|
607 | |
|
608 | |
|
609 | |
|
610 | |
|
611 | |
|
612 | |
|
613 | |
|
614 | |
public LinkcheckModel read( Reader reader, boolean strict ) |
615 | |
throws IOException, XmlPullParserException |
616 | |
{ |
617 | 0 | XmlPullParser parser = new MXParser(); |
618 | |
|
619 | 0 | parser.setInput( reader ); |
620 | |
|
621 | 0 | if ( addDefaultEntities ) |
622 | |
{ |
623 | |
|
624 | |
|
625 | |
|
626 | |
|
627 | 0 | parser.defineEntityReplacementText( "nbsp", "\u00a0" ); |
628 | 0 | parser.defineEntityReplacementText( "iexcl", "\u00a1" ); |
629 | 0 | parser.defineEntityReplacementText( "cent", "\u00a2" ); |
630 | 0 | parser.defineEntityReplacementText( "pound", "\u00a3" ); |
631 | 0 | parser.defineEntityReplacementText( "curren", "\u00a4" ); |
632 | 0 | parser.defineEntityReplacementText( "yen", "\u00a5" ); |
633 | 0 | parser.defineEntityReplacementText( "brvbar", "\u00a6" ); |
634 | 0 | parser.defineEntityReplacementText( "sect", "\u00a7" ); |
635 | 0 | parser.defineEntityReplacementText( "uml", "\u00a8" ); |
636 | 0 | parser.defineEntityReplacementText( "copy", "\u00a9" ); |
637 | 0 | parser.defineEntityReplacementText( "ordf", "\u00aa" ); |
638 | 0 | parser.defineEntityReplacementText( "laquo", "\u00ab" ); |
639 | 0 | parser.defineEntityReplacementText( "not", "\u00ac" ); |
640 | 0 | parser.defineEntityReplacementText( "shy", "\u00ad" ); |
641 | 0 | parser.defineEntityReplacementText( "reg", "\u00ae" ); |
642 | 0 | parser.defineEntityReplacementText( "macr", "\u00af" ); |
643 | 0 | parser.defineEntityReplacementText( "deg", "\u00b0" ); |
644 | 0 | parser.defineEntityReplacementText( "plusmn", "\u00b1" ); |
645 | 0 | parser.defineEntityReplacementText( "sup2", "\u00b2" ); |
646 | 0 | parser.defineEntityReplacementText( "sup3", "\u00b3" ); |
647 | 0 | parser.defineEntityReplacementText( "acute", "\u00b4" ); |
648 | 0 | parser.defineEntityReplacementText( "micro", "\u00b5" ); |
649 | 0 | parser.defineEntityReplacementText( "para", "\u00b6" ); |
650 | 0 | parser.defineEntityReplacementText( "middot", "\u00b7" ); |
651 | 0 | parser.defineEntityReplacementText( "cedil", "\u00b8" ); |
652 | 0 | parser.defineEntityReplacementText( "sup1", "\u00b9" ); |
653 | 0 | parser.defineEntityReplacementText( "ordm", "\u00ba" ); |
654 | 0 | parser.defineEntityReplacementText( "raquo", "\u00bb" ); |
655 | 0 | parser.defineEntityReplacementText( "frac14", "\u00bc" ); |
656 | 0 | parser.defineEntityReplacementText( "frac12", "\u00bd" ); |
657 | 0 | parser.defineEntityReplacementText( "frac34", "\u00be" ); |
658 | 0 | parser.defineEntityReplacementText( "iquest", "\u00bf" ); |
659 | 0 | parser.defineEntityReplacementText( "Agrave", "\u00c0" ); |
660 | 0 | parser.defineEntityReplacementText( "Aacute", "\u00c1" ); |
661 | 0 | parser.defineEntityReplacementText( "Acirc", "\u00c2" ); |
662 | 0 | parser.defineEntityReplacementText( "Atilde", "\u00c3" ); |
663 | 0 | parser.defineEntityReplacementText( "Auml", "\u00c4" ); |
664 | 0 | parser.defineEntityReplacementText( "Aring", "\u00c5" ); |
665 | 0 | parser.defineEntityReplacementText( "AElig", "\u00c6" ); |
666 | 0 | parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); |
667 | 0 | parser.defineEntityReplacementText( "Egrave", "\u00c8" ); |
668 | 0 | parser.defineEntityReplacementText( "Eacute", "\u00c9" ); |
669 | 0 | parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); |
670 | 0 | parser.defineEntityReplacementText( "Euml", "\u00cb" ); |
671 | 0 | parser.defineEntityReplacementText( "Igrave", "\u00cc" ); |
672 | 0 | parser.defineEntityReplacementText( "Iacute", "\u00cd" ); |
673 | 0 | parser.defineEntityReplacementText( "Icirc", "\u00ce" ); |
674 | 0 | parser.defineEntityReplacementText( "Iuml", "\u00cf" ); |
675 | 0 | parser.defineEntityReplacementText( "ETH", "\u00d0" ); |
676 | 0 | parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); |
677 | 0 | parser.defineEntityReplacementText( "Ograve", "\u00d2" ); |
678 | 0 | parser.defineEntityReplacementText( "Oacute", "\u00d3" ); |
679 | 0 | parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); |
680 | 0 | parser.defineEntityReplacementText( "Otilde", "\u00d5" ); |
681 | 0 | parser.defineEntityReplacementText( "Ouml", "\u00d6" ); |
682 | 0 | parser.defineEntityReplacementText( "times", "\u00d7" ); |
683 | 0 | parser.defineEntityReplacementText( "Oslash", "\u00d8" ); |
684 | 0 | parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); |
685 | 0 | parser.defineEntityReplacementText( "Uacute", "\u00da" ); |
686 | 0 | parser.defineEntityReplacementText( "Ucirc", "\u00db" ); |
687 | 0 | parser.defineEntityReplacementText( "Uuml", "\u00dc" ); |
688 | 0 | parser.defineEntityReplacementText( "Yacute", "\u00dd" ); |
689 | 0 | parser.defineEntityReplacementText( "THORN", "\u00de" ); |
690 | 0 | parser.defineEntityReplacementText( "szlig", "\u00df" ); |
691 | 0 | parser.defineEntityReplacementText( "agrave", "\u00e0" ); |
692 | 0 | parser.defineEntityReplacementText( "aacute", "\u00e1" ); |
693 | 0 | parser.defineEntityReplacementText( "acirc", "\u00e2" ); |
694 | 0 | parser.defineEntityReplacementText( "atilde", "\u00e3" ); |
695 | 0 | parser.defineEntityReplacementText( "auml", "\u00e4" ); |
696 | 0 | parser.defineEntityReplacementText( "aring", "\u00e5" ); |
697 | 0 | parser.defineEntityReplacementText( "aelig", "\u00e6" ); |
698 | 0 | parser.defineEntityReplacementText( "ccedil", "\u00e7" ); |
699 | 0 | parser.defineEntityReplacementText( "egrave", "\u00e8" ); |
700 | 0 | parser.defineEntityReplacementText( "eacute", "\u00e9" ); |
701 | 0 | parser.defineEntityReplacementText( "ecirc", "\u00ea" ); |
702 | 0 | parser.defineEntityReplacementText( "euml", "\u00eb" ); |
703 | 0 | parser.defineEntityReplacementText( "igrave", "\u00ec" ); |
704 | 0 | parser.defineEntityReplacementText( "iacute", "\u00ed" ); |
705 | 0 | parser.defineEntityReplacementText( "icirc", "\u00ee" ); |
706 | 0 | parser.defineEntityReplacementText( "iuml", "\u00ef" ); |
707 | 0 | parser.defineEntityReplacementText( "eth", "\u00f0" ); |
708 | 0 | parser.defineEntityReplacementText( "ntilde", "\u00f1" ); |
709 | 0 | parser.defineEntityReplacementText( "ograve", "\u00f2" ); |
710 | 0 | parser.defineEntityReplacementText( "oacute", "\u00f3" ); |
711 | 0 | parser.defineEntityReplacementText( "ocirc", "\u00f4" ); |
712 | 0 | parser.defineEntityReplacementText( "otilde", "\u00f5" ); |
713 | 0 | parser.defineEntityReplacementText( "ouml", "\u00f6" ); |
714 | 0 | parser.defineEntityReplacementText( "divide", "\u00f7" ); |
715 | 0 | parser.defineEntityReplacementText( "oslash", "\u00f8" ); |
716 | 0 | parser.defineEntityReplacementText( "ugrave", "\u00f9" ); |
717 | 0 | parser.defineEntityReplacementText( "uacute", "\u00fa" ); |
718 | 0 | parser.defineEntityReplacementText( "ucirc", "\u00fb" ); |
719 | 0 | parser.defineEntityReplacementText( "uuml", "\u00fc" ); |
720 | 0 | parser.defineEntityReplacementText( "yacute", "\u00fd" ); |
721 | 0 | parser.defineEntityReplacementText( "thorn", "\u00fe" ); |
722 | 0 | parser.defineEntityReplacementText( "yuml", "\u00ff" ); |
723 | |
|
724 | |
|
725 | |
|
726 | |
|
727 | |
|
728 | 0 | parser.defineEntityReplacementText( "OElig", "\u0152" ); |
729 | 0 | parser.defineEntityReplacementText( "oelig", "\u0153" ); |
730 | 0 | parser.defineEntityReplacementText( "Scaron", "\u0160" ); |
731 | 0 | parser.defineEntityReplacementText( "scaron", "\u0161" ); |
732 | 0 | parser.defineEntityReplacementText( "Yuml", "\u0178" ); |
733 | 0 | parser.defineEntityReplacementText( "circ", "\u02c6" ); |
734 | 0 | parser.defineEntityReplacementText( "tilde", "\u02dc" ); |
735 | 0 | parser.defineEntityReplacementText( "ensp", "\u2002" ); |
736 | 0 | parser.defineEntityReplacementText( "emsp", "\u2003" ); |
737 | 0 | parser.defineEntityReplacementText( "thinsp", "\u2009" ); |
738 | 0 | parser.defineEntityReplacementText( "zwnj", "\u200c" ); |
739 | 0 | parser.defineEntityReplacementText( "zwj", "\u200d" ); |
740 | 0 | parser.defineEntityReplacementText( "lrm", "\u200e" ); |
741 | 0 | parser.defineEntityReplacementText( "rlm", "\u200f" ); |
742 | 0 | parser.defineEntityReplacementText( "ndash", "\u2013" ); |
743 | 0 | parser.defineEntityReplacementText( "mdash", "\u2014" ); |
744 | 0 | parser.defineEntityReplacementText( "lsquo", "\u2018" ); |
745 | 0 | parser.defineEntityReplacementText( "rsquo", "\u2019" ); |
746 | 0 | parser.defineEntityReplacementText( "sbquo", "\u201a" ); |
747 | 0 | parser.defineEntityReplacementText( "ldquo", "\u201c" ); |
748 | 0 | parser.defineEntityReplacementText( "rdquo", "\u201d" ); |
749 | 0 | parser.defineEntityReplacementText( "bdquo", "\u201e" ); |
750 | 0 | parser.defineEntityReplacementText( "dagger", "\u2020" ); |
751 | 0 | parser.defineEntityReplacementText( "Dagger", "\u2021" ); |
752 | 0 | parser.defineEntityReplacementText( "permil", "\u2030" ); |
753 | 0 | parser.defineEntityReplacementText( "lsaquo", "\u2039" ); |
754 | 0 | parser.defineEntityReplacementText( "rsaquo", "\u203a" ); |
755 | 0 | parser.defineEntityReplacementText( "euro", "\u20ac" ); |
756 | |
|
757 | |
|
758 | |
|
759 | |
|
760 | |
|
761 | 0 | parser.defineEntityReplacementText( "fnof", "\u0192" ); |
762 | 0 | parser.defineEntityReplacementText( "Alpha", "\u0391" ); |
763 | 0 | parser.defineEntityReplacementText( "Beta", "\u0392" ); |
764 | 0 | parser.defineEntityReplacementText( "Gamma", "\u0393" ); |
765 | 0 | parser.defineEntityReplacementText( "Delta", "\u0394" ); |
766 | 0 | parser.defineEntityReplacementText( "Epsilon", "\u0395" ); |
767 | 0 | parser.defineEntityReplacementText( "Zeta", "\u0396" ); |
768 | 0 | parser.defineEntityReplacementText( "Eta", "\u0397" ); |
769 | 0 | parser.defineEntityReplacementText( "Theta", "\u0398" ); |
770 | 0 | parser.defineEntityReplacementText( "Iota", "\u0399" ); |
771 | 0 | parser.defineEntityReplacementText( "Kappa", "\u039a" ); |
772 | 0 | parser.defineEntityReplacementText( "Lambda", "\u039b" ); |
773 | 0 | parser.defineEntityReplacementText( "Mu", "\u039c" ); |
774 | 0 | parser.defineEntityReplacementText( "Nu", "\u039d" ); |
775 | 0 | parser.defineEntityReplacementText( "Xi", "\u039e" ); |
776 | 0 | parser.defineEntityReplacementText( "Omicron", "\u039f" ); |
777 | 0 | parser.defineEntityReplacementText( "Pi", "\u03a0" ); |
778 | 0 | parser.defineEntityReplacementText( "Rho", "\u03a1" ); |
779 | 0 | parser.defineEntityReplacementText( "Sigma", "\u03a3" ); |
780 | 0 | parser.defineEntityReplacementText( "Tau", "\u03a4" ); |
781 | 0 | parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); |
782 | 0 | parser.defineEntityReplacementText( "Phi", "\u03a6" ); |
783 | 0 | parser.defineEntityReplacementText( "Chi", "\u03a7" ); |
784 | 0 | parser.defineEntityReplacementText( "Psi", "\u03a8" ); |
785 | 0 | parser.defineEntityReplacementText( "Omega", "\u03a9" ); |
786 | 0 | parser.defineEntityReplacementText( "alpha", "\u03b1" ); |
787 | 0 | parser.defineEntityReplacementText( "beta", "\u03b2" ); |
788 | 0 | parser.defineEntityReplacementText( "gamma", "\u03b3" ); |
789 | 0 | parser.defineEntityReplacementText( "delta", "\u03b4" ); |
790 | 0 | parser.defineEntityReplacementText( "epsilon", "\u03b5" ); |
791 | 0 | parser.defineEntityReplacementText( "zeta", "\u03b6" ); |
792 | 0 | parser.defineEntityReplacementText( "eta", "\u03b7" ); |
793 | 0 | parser.defineEntityReplacementText( "theta", "\u03b8" ); |
794 | 0 | parser.defineEntityReplacementText( "iota", "\u03b9" ); |
795 | 0 | parser.defineEntityReplacementText( "kappa", "\u03ba" ); |
796 | 0 | parser.defineEntityReplacementText( "lambda", "\u03bb" ); |
797 | 0 | parser.defineEntityReplacementText( "mu", "\u03bc" ); |
798 | 0 | parser.defineEntityReplacementText( "nu", "\u03bd" ); |
799 | 0 | parser.defineEntityReplacementText( "xi", "\u03be" ); |
800 | 0 | parser.defineEntityReplacementText( "omicron", "\u03bf" ); |
801 | 0 | parser.defineEntityReplacementText( "pi", "\u03c0" ); |
802 | 0 | parser.defineEntityReplacementText( "rho", "\u03c1" ); |
803 | 0 | parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); |
804 | 0 | parser.defineEntityReplacementText( "sigma", "\u03c3" ); |
805 | 0 | parser.defineEntityReplacementText( "tau", "\u03c4" ); |
806 | 0 | parser.defineEntityReplacementText( "upsilon", "\u03c5" ); |
807 | 0 | parser.defineEntityReplacementText( "phi", "\u03c6" ); |
808 | 0 | parser.defineEntityReplacementText( "chi", "\u03c7" ); |
809 | 0 | parser.defineEntityReplacementText( "psi", "\u03c8" ); |
810 | 0 | parser.defineEntityReplacementText( "omega", "\u03c9" ); |
811 | 0 | parser.defineEntityReplacementText( "thetasym", "\u03d1" ); |
812 | 0 | parser.defineEntityReplacementText( "upsih", "\u03d2" ); |
813 | 0 | parser.defineEntityReplacementText( "piv", "\u03d6" ); |
814 | 0 | parser.defineEntityReplacementText( "bull", "\u2022" ); |
815 | 0 | parser.defineEntityReplacementText( "hellip", "\u2026" ); |
816 | 0 | parser.defineEntityReplacementText( "prime", "\u2032" ); |
817 | 0 | parser.defineEntityReplacementText( "Prime", "\u2033" ); |
818 | 0 | parser.defineEntityReplacementText( "oline", "\u203e" ); |
819 | 0 | parser.defineEntityReplacementText( "frasl", "\u2044" ); |
820 | 0 | parser.defineEntityReplacementText( "weierp", "\u2118" ); |
821 | 0 | parser.defineEntityReplacementText( "image", "\u2111" ); |
822 | 0 | parser.defineEntityReplacementText( "real", "\u211c" ); |
823 | 0 | parser.defineEntityReplacementText( "trade", "\u2122" ); |
824 | 0 | parser.defineEntityReplacementText( "alefsym", "\u2135" ); |
825 | 0 | parser.defineEntityReplacementText( "larr", "\u2190" ); |
826 | 0 | parser.defineEntityReplacementText( "uarr", "\u2191" ); |
827 | 0 | parser.defineEntityReplacementText( "rarr", "\u2192" ); |
828 | 0 | parser.defineEntityReplacementText( "darr", "\u2193" ); |
829 | 0 | parser.defineEntityReplacementText( "harr", "\u2194" ); |
830 | 0 | parser.defineEntityReplacementText( "crarr", "\u21b5" ); |
831 | 0 | parser.defineEntityReplacementText( "lArr", "\u21d0" ); |
832 | 0 | parser.defineEntityReplacementText( "uArr", "\u21d1" ); |
833 | 0 | parser.defineEntityReplacementText( "rArr", "\u21d2" ); |
834 | 0 | parser.defineEntityReplacementText( "dArr", "\u21d3" ); |
835 | 0 | parser.defineEntityReplacementText( "hArr", "\u21d4" ); |
836 | 0 | parser.defineEntityReplacementText( "forall", "\u2200" ); |
837 | 0 | parser.defineEntityReplacementText( "part", "\u2202" ); |
838 | 0 | parser.defineEntityReplacementText( "exist", "\u2203" ); |
839 | 0 | parser.defineEntityReplacementText( "empty", "\u2205" ); |
840 | 0 | parser.defineEntityReplacementText( "nabla", "\u2207" ); |
841 | 0 | parser.defineEntityReplacementText( "isin", "\u2208" ); |
842 | 0 | parser.defineEntityReplacementText( "notin", "\u2209" ); |
843 | 0 | parser.defineEntityReplacementText( "ni", "\u220b" ); |
844 | 0 | parser.defineEntityReplacementText( "prod", "\u220f" ); |
845 | 0 | parser.defineEntityReplacementText( "sum", "\u2211" ); |
846 | 0 | parser.defineEntityReplacementText( "minus", "\u2212" ); |
847 | 0 | parser.defineEntityReplacementText( "lowast", "\u2217" ); |
848 | 0 | parser.defineEntityReplacementText( "radic", "\u221a" ); |
849 | 0 | parser.defineEntityReplacementText( "prop", "\u221d" ); |
850 | 0 | parser.defineEntityReplacementText( "infin", "\u221e" ); |
851 | 0 | parser.defineEntityReplacementText( "ang", "\u2220" ); |
852 | 0 | parser.defineEntityReplacementText( "and", "\u2227" ); |
853 | 0 | parser.defineEntityReplacementText( "or", "\u2228" ); |
854 | 0 | parser.defineEntityReplacementText( "cap", "\u2229" ); |
855 | 0 | parser.defineEntityReplacementText( "cup", "\u222a" ); |
856 | 0 | parser.defineEntityReplacementText( "int", "\u222b" ); |
857 | 0 | parser.defineEntityReplacementText( "there4", "\u2234" ); |
858 | 0 | parser.defineEntityReplacementText( "sim", "\u223c" ); |
859 | 0 | parser.defineEntityReplacementText( "cong", "\u2245" ); |
860 | 0 | parser.defineEntityReplacementText( "asymp", "\u2248" ); |
861 | 0 | parser.defineEntityReplacementText( "ne", "\u2260" ); |
862 | 0 | parser.defineEntityReplacementText( "equiv", "\u2261" ); |
863 | 0 | parser.defineEntityReplacementText( "le", "\u2264" ); |
864 | 0 | parser.defineEntityReplacementText( "ge", "\u2265" ); |
865 | 0 | parser.defineEntityReplacementText( "sub", "\u2282" ); |
866 | 0 | parser.defineEntityReplacementText( "sup", "\u2283" ); |
867 | 0 | parser.defineEntityReplacementText( "nsub", "\u2284" ); |
868 | 0 | parser.defineEntityReplacementText( "sube", "\u2286" ); |
869 | 0 | parser.defineEntityReplacementText( "supe", "\u2287" ); |
870 | 0 | parser.defineEntityReplacementText( "oplus", "\u2295" ); |
871 | 0 | parser.defineEntityReplacementText( "otimes", "\u2297" ); |
872 | 0 | parser.defineEntityReplacementText( "perp", "\u22a5" ); |
873 | 0 | parser.defineEntityReplacementText( "sdot", "\u22c5" ); |
874 | 0 | parser.defineEntityReplacementText( "lceil", "\u2308" ); |
875 | 0 | parser.defineEntityReplacementText( "rceil", "\u2309" ); |
876 | 0 | parser.defineEntityReplacementText( "lfloor", "\u230a" ); |
877 | 0 | parser.defineEntityReplacementText( "rfloor", "\u230b" ); |
878 | 0 | parser.defineEntityReplacementText( "lang", "\u2329" ); |
879 | 0 | parser.defineEntityReplacementText( "rang", "\u232a" ); |
880 | 0 | parser.defineEntityReplacementText( "loz", "\u25ca" ); |
881 | 0 | parser.defineEntityReplacementText( "spades", "\u2660" ); |
882 | 0 | parser.defineEntityReplacementText( "clubs", "\u2663" ); |
883 | 0 | parser.defineEntityReplacementText( "hearts", "\u2665" ); |
884 | 0 | parser.defineEntityReplacementText( "diams", "\u2666" ); |
885 | |
|
886 | |
} |
887 | |
|
888 | 0 | parser.next(); |
889 | 0 | return parseLinkcheckModel( "linkcheckModel", parser, strict ); |
890 | |
} |
891 | |
|
892 | |
|
893 | |
|
894 | |
|
895 | |
|
896 | |
|
897 | |
|
898 | |
|
899 | |
|
900 | |
public LinkcheckModel read( Reader reader ) |
901 | |
throws IOException, XmlPullParserException |
902 | |
{ |
903 | 0 | return read( reader, true ); |
904 | |
} |
905 | |
|
906 | |
|
907 | |
|
908 | |
|
909 | |
|
910 | |
|
911 | |
|
912 | |
|
913 | |
|
914 | |
|
915 | |
public LinkcheckModel read( InputStream in, boolean strict ) |
916 | |
throws IOException, XmlPullParserException |
917 | |
{ |
918 | 0 | Reader reader = ReaderFactory.newXmlReader( in ); |
919 | |
|
920 | 0 | return read( reader, strict ); |
921 | |
} |
922 | |
|
923 | |
|
924 | |
|
925 | |
|
926 | |
|
927 | |
|
928 | |
|
929 | |
|
930 | |
|
931 | |
public LinkcheckModel read( InputStream in ) |
932 | |
throws IOException, XmlPullParserException |
933 | |
{ |
934 | 0 | Reader reader = ReaderFactory.newXmlReader( in ); |
935 | |
|
936 | 0 | return read( reader ); |
937 | |
} |
938 | |
|
939 | |
|
940 | |
|
941 | |
|
942 | |
|
943 | |
|
944 | |
public void setAddDefaultEntities( boolean addDefaultEntities ) |
945 | |
{ |
946 | 0 | this.addDefaultEntities = addDefaultEntities; |
947 | 0 | } |
948 | |
|
949 | |
} |