1
2
3
4
5
6 package org.codehaus.modello.test.features.io.xpp3;
7
8
9
10
11
12 import java.io.IOException;
13 import java.io.InputStream;
14 import java.io.Reader;
15 import java.text.DateFormat;
16 import org.codehaus.modello.test.features.Action;
17 import org.codehaus.modello.test.features.AnnotationTest;
18 import org.codehaus.modello.test.features.ArrayFeatures;
19 import org.codehaus.modello.test.features.AssociationFeatures;
20 import org.codehaus.modello.test.features.BaseClass;
21 import org.codehaus.modello.test.features.BidiInList;
22 import org.codehaus.modello.test.features.BidiInSet;
23 import org.codehaus.modello.test.features.Bidirectional;
24 import org.codehaus.modello.test.features.ContentTest;
25 import org.codehaus.modello.test.features.DueTo;
26 import org.codehaus.modello.test.features.Features;
27 import org.codehaus.modello.test.features.File;
28 import org.codehaus.modello.test.features.InterfacesFeature;
29 import org.codehaus.modello.test.features.JavaFeatures;
30 import org.codehaus.modello.test.features.NodeItem;
31 import org.codehaus.modello.test.features.Reference;
32 import org.codehaus.modello.test.features.SimpleInterface;
33 import org.codehaus.modello.test.features.SimpleTypes;
34 import org.codehaus.modello.test.features.SubClassLevel1;
35 import org.codehaus.modello.test.features.SubClassLevel2;
36 import org.codehaus.modello.test.features.SubClassLevel3;
37 import org.codehaus.modello.test.features.SubInterface;
38 import org.codehaus.modello.test.features.SuperThing;
39 import org.codehaus.modello.test.features.Thing;
40 import org.codehaus.modello.test.features.Thingy;
41 import org.codehaus.modello.test.features.XdocFeatures;
42 import org.codehaus.modello.test.features.XmlAttributes;
43 import org.codehaus.modello.test.features.XmlContent;
44 import org.codehaus.modello.test.features.XmlContentLong;
45 import org.codehaus.modello.test.features.XmlContentLongWithAttributes;
46 import org.codehaus.modello.test.features.XmlFeatures;
47 import org.codehaus.modello.test.features.XmlFieldsOrder;
48 import org.codehaus.modello.test.features.XmlFieldsOrderParent;
49 import org.codehaus.modello.test.features.XmlFieldsOrderParent2;
50 import org.codehaus.modello.test.features.XmlTransientFields;
51 import org.codehaus.modello.test.features.XsdFeatures;
52 import org.codehaus.modello.test.features.other.PackageNameFeature;
53 import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
54 import org.codehaus.plexus.util.xml.XmlStreamReader;
55 import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
56 import org.codehaus.plexus.util.xml.pull.MXParser;
57 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
58 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
59
60
61
62
63
64
65 @SuppressWarnings( "all" )
66 public class ModelloFeaturesTestXpp3Reader
67 {
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 private boolean addDefaultEntities = true;
84
85
86
87
88 public final ContentTransformer contentTransformer;
89
90
91
92
93
94
95 public ModelloFeaturesTestXpp3Reader()
96 {
97 this( new ContentTransformer()
98 {
99 public String transform( String source, String fieldName )
100 {
101 return source;
102 }
103 } );
104 }
105
106 public ModelloFeaturesTestXpp3Reader(ContentTransformer contentTransformer)
107 {
108 this.contentTransformer = contentTransformer;
109 }
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set<String> parsed )
128 throws XmlPullParserException
129 {
130 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
131 {
132 return false;
133 }
134 if ( !parsed.add( tagName ) )
135 {
136 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
137 }
138 return true;
139 }
140
141
142
143
144
145
146
147
148
149
150
151
152 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
153 throws XmlPullParserException, IOException
154 {
155
156 if ( strict )
157 {
158 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
159 }
160 }
161
162
163
164
165
166
167
168
169
170
171 private void checkUnknownElement( XmlPullParser parser, boolean strict )
172 throws XmlPullParserException, IOException
173 {
174 if ( strict )
175 {
176 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
177 }
178
179 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
180 {
181 int eventType = parser.next();
182 if ( eventType == XmlPullParser.START_TAG )
183 {
184 unrecognizedTagCount++;
185 }
186 else if ( eventType == XmlPullParser.END_TAG )
187 {
188 unrecognizedTagCount--;
189 }
190 }
191 }
192
193
194
195
196
197
198 public boolean getAddDefaultEntities()
199 {
200 return addDefaultEntities;
201 }
202
203
204
205
206
207
208
209
210
211
212
213 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
214 throws XmlPullParserException
215 {
216 return getBooleanValue( s, attribute, parser, null );
217 }
218
219
220
221
222
223
224
225
226
227
228
229
230 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
231 throws XmlPullParserException
232 {
233 if ( s != null && s.length() != 0 )
234 {
235 return Boolean.valueOf( s ).booleanValue();
236 }
237 if ( defaultValue != null )
238 {
239 return Boolean.valueOf( defaultValue ).booleanValue();
240 }
241 return false;
242 }
243
244
245
246
247
248
249
250
251
252
253
254
255 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
256 throws XmlPullParserException
257 {
258 if ( s != null )
259 {
260 try
261 {
262 return Byte.valueOf( s ).byteValue();
263 }
264 catch ( NumberFormatException nfe )
265 {
266 if ( strict )
267 {
268 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
269 }
270 }
271 }
272 return 0;
273 }
274
275
276
277
278
279
280
281
282
283
284
285 private char getCharacterValue( String s, String attribute, XmlPullParser parser )
286 throws XmlPullParserException
287 {
288 if ( s != null )
289 {
290 return s.charAt( 0 );
291 }
292 return 0;
293 }
294
295
296
297
298
299
300
301
302
303
304
305 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
306 throws XmlPullParserException
307 {
308 return getDateValue( s, attribute, null, parser );
309 }
310
311
312
313
314
315
316
317
318
319
320
321
322 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
323 throws XmlPullParserException
324 {
325 if ( s != null )
326 {
327 String effectiveDateFormat = dateFormat;
328 if ( dateFormat == null )
329 {
330 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
331 }
332 if ( "long".equals( effectiveDateFormat ) )
333 {
334 try
335 {
336 return new java.util.Date( Long.parseLong( s ) );
337 }
338 catch ( NumberFormatException e )
339 {
340 throw new XmlPullParserException( e.getMessage(), parser, e );
341 }
342 }
343 else
344 {
345 try
346 {
347 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
348 return dateParser.parse( s );
349 }
350 catch ( java.text.ParseException e )
351 {
352 throw new XmlPullParserException( e.getMessage(), parser, e );
353 }
354 }
355 }
356 return null;
357 }
358
359
360
361
362
363
364
365
366
367
368
369
370 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
371 throws XmlPullParserException
372 {
373 if ( s != null )
374 {
375 try
376 {
377 return Double.valueOf( s ).doubleValue();
378 }
379 catch ( NumberFormatException nfe )
380 {
381 if ( strict )
382 {
383 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
384 }
385 }
386 }
387 return 0;
388 }
389
390
391
392
393
394
395
396
397
398
399
400
401 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
402 throws XmlPullParserException
403 {
404 if ( s != null )
405 {
406 try
407 {
408 return Float.valueOf( s ).floatValue();
409 }
410 catch ( NumberFormatException nfe )
411 {
412 if ( strict )
413 {
414 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
415 }
416 }
417 }
418 return 0;
419 }
420
421
422
423
424
425
426
427
428
429
430
431
432 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
433 throws XmlPullParserException
434 {
435 if ( s != null )
436 {
437 try
438 {
439 return Integer.valueOf( s ).intValue();
440 }
441 catch ( NumberFormatException nfe )
442 {
443 if ( strict )
444 {
445 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
446 }
447 }
448 }
449 return 0;
450 }
451
452
453
454
455
456
457
458
459
460
461
462
463 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
464 throws XmlPullParserException
465 {
466 if ( s != null )
467 {
468 try
469 {
470 return Long.valueOf( s ).longValue();
471 }
472 catch ( NumberFormatException nfe )
473 {
474 if ( strict )
475 {
476 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
477 }
478 }
479 }
480 return 0;
481 }
482
483
484
485
486
487
488
489
490
491
492
493
494 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
495 throws XmlPullParserException
496 {
497 if ( s == null )
498 {
499 if ( strict )
500 {
501 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
502 }
503 }
504 return s;
505 }
506
507
508
509
510
511
512
513
514
515
516
517
518 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
519 throws XmlPullParserException
520 {
521 if ( s != null )
522 {
523 try
524 {
525 return Short.valueOf( s ).shortValue();
526 }
527 catch ( NumberFormatException nfe )
528 {
529 if ( strict )
530 {
531 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
532 }
533 }
534 }
535 return 0;
536 }
537
538
539
540
541
542
543
544 private String getTrimmedValue( String s )
545 {
546 if ( s != null )
547 {
548 s = s.trim();
549 }
550 return s;
551 }
552
553
554
555
556
557
558
559
560 private String interpolatedTrimmed( String value, String context )
561 {
562 return getTrimmedValue( contentTransformer.transform( value, context ) );
563 }
564
565
566
567
568
569
570
571
572
573
574 private int nextTag( XmlPullParser parser )
575 throws IOException, XmlPullParserException
576 {
577 int eventType = parser.next();
578 if ( eventType == XmlPullParser.TEXT )
579 {
580 eventType = parser.next();
581 }
582 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
583 {
584 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
585 }
586 return eventType;
587 }
588
589
590
591
592
593
594
595
596
597
598
599 public Features read( XmlPullParser parser, boolean strict )
600 throws IOException, XmlPullParserException
601 {
602 Features features = null;
603 int eventType = parser.getEventType();
604 boolean parsed = false;
605 while ( eventType != XmlPullParser.END_DOCUMENT )
606 {
607 if ( eventType == XmlPullParser.START_TAG )
608 {
609 if ( strict && ! "features-demo".equals( parser.getName() ) )
610 {
611 throw new XmlPullParserException( "Expected root element 'features-demo' but found '" + parser.getName() + "'", parser, null );
612 }
613 else if ( parsed )
614 {
615
616 throw new XmlPullParserException( "Duplicated tag: 'features-demo'", parser, null );
617 }
618 features = parseFeatures( parser, strict );
619 features.setModelEncoding( parser.getInputEncoding() );
620 parsed = true;
621 }
622 eventType = parser.next();
623 }
624 if ( parsed )
625 {
626 return features;
627 }
628 throw new XmlPullParserException( "Expected root element 'features-demo' but found no element at all: invalid XML document", parser, null );
629 }
630
631
632
633
634
635
636
637
638
639
640
641 public Features read( Reader reader, boolean strict )
642 throws IOException, XmlPullParserException
643 {
644 XmlPullParser parser = addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser( );
645
646 parser.setInput( reader );
647
648
649 return read( parser, strict );
650 }
651
652
653
654
655
656
657
658
659
660
661 public Features read( Reader reader )
662 throws IOException, XmlPullParserException
663 {
664 return read( reader, true );
665 }
666
667
668
669
670
671
672
673
674
675
676
677 public Features read( InputStream in, boolean strict )
678 throws IOException, XmlPullParserException
679 {
680 return read( new XmlStreamReader( in ), strict );
681 }
682
683
684
685
686
687
688
689
690
691
692 public Features read( InputStream in )
693 throws IOException, XmlPullParserException
694 {
695 return read( new XmlStreamReader( in ) );
696 }
697
698
699
700
701
702
703
704
705
706
707
708 private Action parseAction( XmlPullParser parser, boolean strict )
709 throws IOException, XmlPullParserException
710 {
711 String tagName = parser.getName();
712 Actiono/test/features/Action.html#Action">Action action = new Action();
713 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
714 {
715 String name = parser.getAttributeName( i );
716 String value = parser.getAttributeValue( i );
717
718 if ( name.indexOf( ':' ) >= 0 )
719 {
720
721 }
722 else if ( "dev".equals( name ) )
723 {
724 action.setDev( interpolatedTrimmed( value, "dev" ) );
725 }
726 else
727 {
728 checkUnknownAttribute( parser, name, tagName, strict );
729 }
730 }
731 action.setAction( interpolatedTrimmed( parser.nextText(), "action" ) );
732 return action;
733 }
734
735
736
737
738
739
740
741
742
743
744
745 private AnnotationTest parseAnnotationTest( XmlPullParser parser, boolean strict )
746 throws IOException, XmlPullParserException
747 {
748 String tagName = parser.getName();
749 AnnotationTestAnnotationTest.html#AnnotationTest">AnnotationTest annotationTest = new AnnotationTest();
750 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
751 {
752 String name = parser.getAttributeName( i );
753 String value = parser.getAttributeValue( i );
754
755 if ( name.indexOf( ':' ) >= 0 )
756 {
757
758 }
759 else
760 {
761 checkUnknownAttribute( parser, name, tagName, strict );
762 }
763 }
764 java.util.Set<String> parsed = new java.util.HashSet<String>();
765 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
766 {
767 if ( checkFieldWithDuplicate( parser, "anyField", null, parsed ) )
768 {
769 annotationTest.setAnyField( interpolatedTrimmed( parser.nextText(), "anyField" ) );
770 }
771 else
772 {
773 checkUnknownElement( parser, strict );
774 }
775 }
776 return annotationTest;
777 }
778
779
780
781
782
783
784
785
786
787
788
789 private ArrayFeatures parseArrayFeatures( XmlPullParser parser, boolean strict )
790 throws IOException, XmlPullParserException
791 {
792 String tagName = parser.getName();
793 ArrayFeaturess/ArrayFeatures.html#ArrayFeatures">ArrayFeatures arrayFeatures = new ArrayFeatures();
794 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
795 {
796 String name = parser.getAttributeName( i );
797 String value = parser.getAttributeValue( i );
798
799 if ( name.indexOf( ':' ) >= 0 )
800 {
801
802 }
803 else
804 {
805 checkUnknownAttribute( parser, name, tagName, strict );
806 }
807 }
808 java.util.Set<String> parsed = new java.util.HashSet<String>();
809 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
810 {
811 checkUnknownElement( parser, strict );
812 }
813 return arrayFeatures;
814 }
815
816
817
818
819
820
821
822
823
824
825
826 private AssociationFeatures parseAssociationFeatures( XmlPullParser parser, boolean strict )
827 throws IOException, XmlPullParserException
828 {
829 String tagName = parser.getName();
830 AssociationFeaturesnFeatures.html#AssociationFeatures">AssociationFeatures associationFeatures = new AssociationFeatures();
831 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
832 {
833 String name = parser.getAttributeName( i );
834 String value = parser.getAttributeValue( i );
835
836 if ( name.indexOf( ':' ) >= 0 )
837 {
838
839 }
840 else
841 {
842 checkUnknownAttribute( parser, name, tagName, strict );
843 }
844 }
845 java.util.Set<String> parsed = new java.util.HashSet<String>();
846 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
847 {
848 if ( checkFieldWithDuplicate( parser, "listReferences", null, parsed ) )
849 {
850 java.util.List<Reference> listReferences = new java.util.ArrayList<Reference>();
851 while ( parser.nextTag() == XmlPullParser.START_TAG )
852 {
853 if ( "listReference".equals( parser.getName() ) )
854 {
855 listReferences.add( parseReference( parser, strict ) );
856 }
857 else
858 {
859 checkUnknownElement( parser, strict );
860 }
861 }
862 associationFeatures.setListReferences( listReferences );
863 }
864 else if ( checkFieldWithDuplicate( parser, "setReferences", null, parsed ) )
865 {
866 java.util.Set<Reference> setReferences = new java.util.HashSet<Reference>();
867 while ( parser.nextTag() == XmlPullParser.START_TAG )
868 {
869 if ( "setReference".equals( parser.getName() ) )
870 {
871 setReferences.add( parseReference( parser, strict ) );
872 }
873 else
874 {
875 checkUnknownElement( parser, strict );
876 }
877 }
878 associationFeatures.setSetReferences( setReferences );
879 }
880 else if ( checkFieldWithDuplicate( parser, "listStrings", null, parsed ) )
881 {
882 java.util.List<String> listStrings = new java.util.ArrayList<String>();
883 while ( parser.nextTag() == XmlPullParser.START_TAG )
884 {
885 if ( "listString".equals( parser.getName() ) )
886 {
887 listStrings.add( interpolatedTrimmed( parser.nextText(), "listStrings" ) );
888 }
889 else
890 {
891 checkUnknownElement( parser, strict );
892 }
893 }
894 associationFeatures.setListStrings( listStrings );
895 }
896 else if ( checkFieldWithDuplicate( parser, "setStrings", null, parsed ) )
897 {
898 java.util.Set<String> setStrings = new java.util.HashSet<String>();
899 while ( parser.nextTag() == XmlPullParser.START_TAG )
900 {
901 if ( "setString".equals( parser.getName() ) )
902 {
903 setStrings.add( interpolatedTrimmed( parser.nextText(), "setStrings" ) );
904 }
905 else
906 {
907 checkUnknownElement( parser, strict );
908 }
909 }
910 associationFeatures.setSetStrings( setStrings );
911 }
912 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
913 {
914 while ( parser.nextTag() == XmlPullParser.START_TAG )
915 {
916 String key = parser.getName();
917 String value = parser.nextText().trim();
918 associationFeatures.addProperty( key, value );
919 }
920 }
921 else if ( checkFieldWithDuplicate( parser, "bidi", null, parsed ) )
922 {
923 associationFeatures.setBidi( parseBidirectional( parser, strict ) );
924 }
925 else if ( checkFieldWithDuplicate( parser, "listOfBidis", null, parsed ) )
926 {
927 java.util.List<BidiInList> listOfBidis = new java.util.ArrayList<BidiInList>();
928 while ( parser.nextTag() == XmlPullParser.START_TAG )
929 {
930 if ( "listOfBidi".equals( parser.getName() ) )
931 {
932 listOfBidis.add( parseBidiInList( parser, strict ) );
933 }
934 else
935 {
936 checkUnknownElement( parser, strict );
937 }
938 }
939 associationFeatures.setListOfBidis( listOfBidis );
940 }
941 else if ( checkFieldWithDuplicate( parser, "setOfBidis", null, parsed ) )
942 {
943 java.util.Set<BidiInSet> setOfBidis = new java.util.HashSet<BidiInSet>();
944 while ( parser.nextTag() == XmlPullParser.START_TAG )
945 {
946 if ( "setOfBidi".equals( parser.getName() ) )
947 {
948 setOfBidis.add( parseBidiInSet( parser, strict ) );
949 }
950 else
951 {
952 checkUnknownElement( parser, strict );
953 }
954 }
955 associationFeatures.setSetOfBidis( setOfBidis );
956 }
957 else
958 {
959 checkUnknownElement( parser, strict );
960 }
961 }
962 return associationFeatures;
963 }
964
965
966
967
968
969
970
971
972
973
974
975 private BaseClass parseBaseClass( XmlPullParser parser, boolean strict )
976 throws IOException, XmlPullParserException
977 {
978 String tagName = parser.getName();
979 BaseClass/features/BaseClass.html#BaseClass">BaseClass baseClass = new BaseClass();
980 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
981 {
982 String name = parser.getAttributeName( i );
983 String value = parser.getAttributeValue( i );
984
985 if ( name.indexOf( ':' ) >= 0 )
986 {
987
988 }
989 else if ( "baseAttribute".equals( name ) )
990 {
991 baseClass.setBaseAttribute( getIntegerValue( interpolatedTrimmed( value, "baseAttribute" ), "baseAttribute", parser, strict ) );
992 }
993 else
994 {
995 checkUnknownAttribute( parser, name, tagName, strict );
996 }
997 }
998 java.util.Set<String> parsed = new java.util.HashSet<String>();
999 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1000 {
1001 if ( checkFieldWithDuplicate( parser, "baseElement", null, parsed ) )
1002 {
1003 baseClass.setBaseElement( getIntegerValue( interpolatedTrimmed( parser.nextText(), "baseElement" ), "baseElement", parser, strict ) );
1004 }
1005 else
1006 {
1007 checkUnknownElement( parser, strict );
1008 }
1009 }
1010 return baseClass;
1011 }
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023 private BidiInList parseBidiInList( XmlPullParser parser, boolean strict )
1024 throws IOException, XmlPullParserException
1025 {
1026 String tagName = parser.getName();
1027 BidiInListeatures/BidiInList.html#BidiInList">BidiInList bidiInList = new BidiInList();
1028 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1029 {
1030 String name = parser.getAttributeName( i );
1031 String value = parser.getAttributeValue( i );
1032
1033 if ( name.indexOf( ':' ) >= 0 )
1034 {
1035
1036 }
1037 else
1038 {
1039 checkUnknownAttribute( parser, name, tagName, strict );
1040 }
1041 }
1042 java.util.Set<String> parsed = new java.util.HashSet<String>();
1043 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1044 {
1045 if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
1046 {
1047 bidiInList.setParent( parseAssociationFeatures( parser, strict ) );
1048 }
1049 else
1050 {
1051 checkUnknownElement( parser, strict );
1052 }
1053 }
1054 return bidiInList;
1055 }
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067 private BidiInSet parseBidiInSet( XmlPullParser parser, boolean strict )
1068 throws IOException, XmlPullParserException
1069 {
1070 String tagName = parser.getName();
1071 BidiInSet/features/BidiInSet.html#BidiInSet">BidiInSet bidiInSet = new BidiInSet();
1072 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1073 {
1074 String name = parser.getAttributeName( i );
1075 String value = parser.getAttributeValue( i );
1076
1077 if ( name.indexOf( ':' ) >= 0 )
1078 {
1079
1080 }
1081 else
1082 {
1083 checkUnknownAttribute( parser, name, tagName, strict );
1084 }
1085 }
1086 java.util.Set<String> parsed = new java.util.HashSet<String>();
1087 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1088 {
1089 if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
1090 {
1091 bidiInSet.setParent( parseAssociationFeatures( parser, strict ) );
1092 }
1093 else
1094 {
1095 checkUnknownElement( parser, strict );
1096 }
1097 }
1098 return bidiInSet;
1099 }
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111 private Bidirectional parseBidirectional( XmlPullParser parser, boolean strict )
1112 throws IOException, XmlPullParserException
1113 {
1114 String tagName = parser.getName();
1115 Bidirectionals/Bidirectional.html#Bidirectional">Bidirectional bidirectional = new Bidirectional();
1116 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1117 {
1118 String name = parser.getAttributeName( i );
1119 String value = parser.getAttributeValue( i );
1120
1121 if ( name.indexOf( ':' ) >= 0 )
1122 {
1123
1124 }
1125 else
1126 {
1127 checkUnknownAttribute( parser, name, tagName, strict );
1128 }
1129 }
1130 java.util.Set<String> parsed = new java.util.HashSet<String>();
1131 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1132 {
1133 if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
1134 {
1135 bidirectional.setParent( parseAssociationFeatures( parser, strict ) );
1136 }
1137 else
1138 {
1139 checkUnknownElement( parser, strict );
1140 }
1141 }
1142 return bidirectional;
1143 }
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155 private ContentTest parseContentTest( XmlPullParser parser, boolean strict )
1156 throws IOException, XmlPullParserException
1157 {
1158 String tagName = parser.getName();
1159 ContentTesttures/ContentTest.html#ContentTest">ContentTest contentTest = new ContentTest();
1160 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1161 {
1162 String name = parser.getAttributeName( i );
1163 String value = parser.getAttributeValue( i );
1164
1165 if ( name.indexOf( ':' ) >= 0 )
1166 {
1167
1168 }
1169 else if ( "attr".equals( name ) )
1170 {
1171 contentTest.setAttr( interpolatedTrimmed( value, "attr" ) );
1172 }
1173 else if ( "attr2".equals( name ) )
1174 {
1175 contentTest.setAttr2( getIntegerValue( interpolatedTrimmed( value, "attr2" ), "attr2", parser, strict ) );
1176 }
1177 else
1178 {
1179 checkUnknownAttribute( parser, name, tagName, strict );
1180 }
1181 }
1182 contentTest.setContent( interpolatedTrimmed( parser.nextText(), "content" ) );
1183 return contentTest;
1184 }
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196 private DueTo parseDueTo( XmlPullParser parser, boolean strict )
1197 throws IOException, XmlPullParserException
1198 {
1199 String tagName = parser.getName();
1200 DueTollo/test/features/DueTo.html#DueTo">DueTo dueTo = new DueTo();
1201 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1202 {
1203 String name = parser.getAttributeName( i );
1204 String value = parser.getAttributeValue( i );
1205
1206 if ( name.indexOf( ':' ) >= 0 )
1207 {
1208
1209 }
1210 else if ( "name".equals( name ) )
1211 {
1212 dueTo.setName( interpolatedTrimmed( value, "name" ) );
1213 }
1214 else if ( "email".equals( name ) )
1215 {
1216 dueTo.setEmail( interpolatedTrimmed( value, "email" ) );
1217 }
1218 else
1219 {
1220 checkUnknownAttribute( parser, name, tagName, strict );
1221 }
1222 }
1223 java.util.Set<String> parsed = new java.util.HashSet<String>();
1224 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1225 {
1226 checkUnknownElement( parser, strict );
1227 }
1228 return dueTo;
1229 }
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241 private Features parseFeatures( XmlPullParser parser, boolean strict )
1242 throws IOException, XmlPullParserException
1243 {
1244 String tagName = parser.getName();
1245 Featuresst/features/Features.html#Features">Features features = new Features();
1246 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1247 {
1248 String name = parser.getAttributeName( i );
1249 String value = parser.getAttributeValue( i );
1250
1251 if ( name.indexOf( ':' ) >= 0 )
1252 {
1253
1254 }
1255 else if ( "xmlns".equals( name ) )
1256 {
1257
1258 }
1259 else
1260 {
1261 checkUnknownAttribute( parser, name, tagName, strict );
1262 }
1263 }
1264 java.util.Set<String> parsed = new java.util.HashSet<String>();
1265 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1266 {
1267 if ( checkFieldWithDuplicate( parser, "versionField", null, parsed ) )
1268 {
1269 features.setVersionField( interpolatedTrimmed( parser.nextText(), "versionField" ) );
1270 }
1271 else if ( checkFieldWithDuplicate( parser, "comment", null, parsed ) )
1272 {
1273 features.setComment( interpolatedTrimmed( parser.nextText(), "comment" ) );
1274 }
1275 else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
1276 {
1277 features.setDescription( interpolatedTrimmed( parser.nextText(), "description" ) );
1278 }
1279 else if ( checkFieldWithDuplicate( parser, "required", null, parsed ) )
1280 {
1281 features.setRequired( interpolatedTrimmed( parser.nextText(), "required" ) );
1282 }
1283 else if ( checkFieldWithDuplicate( parser, "identifier", null, parsed ) )
1284 {
1285 features.setIdentifier( interpolatedTrimmed( parser.nextText(), "identifier" ) );
1286 }
1287 else if ( checkFieldWithDuplicate( parser, "identifierPart2", null, parsed ) )
1288 {
1289 features.setIdentifierPart2( parseReference( parser, strict ) );
1290 }
1291 else if ( checkFieldWithDuplicate( parser, "simpleTypes", null, parsed ) )
1292 {
1293 features.setSimpleTypes( parseSimpleTypes( parser, strict ) );
1294 }
1295 else if ( checkFieldWithDuplicate( parser, "defaultValues", null, parsed ) )
1296 {
1297 features.setDefaultValues( parseSimpleTypes( parser, strict ) );
1298 }
1299 else if ( checkFieldWithDuplicate( parser, "arrays", null, parsed ) )
1300 {
1301 features.setArrays( parseArrayFeatures( parser, strict ) );
1302 }
1303 else if ( checkFieldWithDuplicate( parser, "associationFeatures", null, parsed ) )
1304 {
1305 features.setAssociationFeatures( parseAssociationFeatures( parser, strict ) );
1306 }
1307 else if ( checkFieldWithDuplicate( parser, "javaFeatures", null, parsed ) )
1308 {
1309 features.setJavaFeatures( parseJavaFeatures( parser, strict ) );
1310 }
1311 else if ( checkFieldWithDuplicate( parser, "xmlFeatures", null, parsed ) )
1312 {
1313 features.setXmlFeatures( parseXmlFeatures( parser, strict ) );
1314 }
1315 else if ( checkFieldWithDuplicate( parser, "xdocFeatures", null, parsed ) )
1316 {
1317 features.setXdocFeatures( parseXdocFeatures( parser, strict ) );
1318 }
1319 else if ( checkFieldWithDuplicate( parser, "node", null, parsed ) )
1320 {
1321 features.setNode( parseNodeItem( parser, strict ) );
1322 }
1323 else if ( checkFieldWithDuplicate( parser, "cloneable", null, parsed ) )
1324 {
1325 features.setCloneable( parseThing( parser, strict ) );
1326 }
1327 else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) )
1328 {
1329 features.setFile( parseFile( parser, strict ) );
1330 }
1331 else if ( checkFieldWithDuplicate( parser, "action", null, parsed ) )
1332 {
1333 features.setAction( parseAction( parser, strict ) );
1334 }
1335 else
1336 {
1337 checkUnknownElement( parser, strict );
1338 }
1339 }
1340 return features;
1341 }
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353 private File parseFile( XmlPullParser parser, boolean strict )
1354 throws IOException, XmlPullParserException
1355 {
1356 String tagName = parser.getName();
1357 Filedello/test/features/File.html#File">File file = new File();
1358 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1359 {
1360 String name = parser.getAttributeName( i );
1361 String value = parser.getAttributeValue( i );
1362
1363 if ( name.indexOf( ':' ) >= 0 )
1364 {
1365
1366 }
1367 else
1368 {
1369 checkUnknownAttribute( parser, name, tagName, strict );
1370 }
1371 }
1372 java.util.Set<String> parsed = new java.util.HashSet<String>();
1373 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1374 {
1375 if ( checkFieldWithDuplicate( parser, "file", null, parsed ) )
1376 {
1377 file.setFile( interpolatedTrimmed( parser.nextText(), "file" ) );
1378 }
1379 else
1380 {
1381 checkUnknownElement( parser, strict );
1382 }
1383 }
1384 return file;
1385 }
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397 private InterfacesFeature parseInterfacesFeature( XmlPullParser parser, boolean strict )
1398 throws IOException, XmlPullParserException
1399 {
1400 String tagName = parser.getName();
1401 InterfacesFeatureacesFeature.html#InterfacesFeature">InterfacesFeature interfacesFeature = new InterfacesFeature();
1402 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1403 {
1404 String name = parser.getAttributeName( i );
1405 String value = parser.getAttributeValue( i );
1406
1407 if ( name.indexOf( ':' ) >= 0 )
1408 {
1409
1410 }
1411 else
1412 {
1413 checkUnknownAttribute( parser, name, tagName, strict );
1414 }
1415 }
1416 java.util.Set<String> parsed = new java.util.HashSet<String>();
1417 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1418 {
1419 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1420 {
1421 interfacesFeature.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
1422 }
1423 else
1424 {
1425 checkUnknownElement( parser, strict );
1426 }
1427 }
1428 return interfacesFeature;
1429 }
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441 private JavaFeatures parseJavaFeatures( XmlPullParser parser, boolean strict )
1442 throws IOException, XmlPullParserException
1443 {
1444 String tagName = parser.getName();
1445 JavaFeaturesres/JavaFeatures.html#JavaFeatures">JavaFeatures javaFeatures = new JavaFeatures();
1446 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1447 {
1448 String name = parser.getAttributeName( i );
1449 String value = parser.getAttributeValue( i );
1450
1451 if ( name.indexOf( ':' ) >= 0 )
1452 {
1453
1454 }
1455 else
1456 {
1457 checkUnknownAttribute( parser, name, tagName, strict );
1458 }
1459 }
1460 java.util.Set<String> parsed = new java.util.HashSet<String>();
1461 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1462 {
1463 if ( checkFieldWithDuplicate( parser, "interfaces", null, parsed ) )
1464 {
1465 javaFeatures.setInterfaces( parseInterfacesFeature( parser, strict ) );
1466 }
1467 else if ( checkFieldWithDuplicate( parser, "packageName", null, parsed ) )
1468 {
1469 javaFeatures.setPackageName( parsePackageNameFeature( parser, strict ) );
1470 }
1471 else if ( checkFieldWithDuplicate( parser, "base", null, parsed ) )
1472 {
1473 javaFeatures.setBase( parseBaseClass( parser, strict ) );
1474 }
1475 else if ( checkFieldWithDuplicate( parser, "subClass", null, parsed ) )
1476 {
1477 javaFeatures.setSubClass( parseSubClassLevel1( parser, strict ) );
1478 }
1479 else if ( checkFieldWithDuplicate( parser, "subClass2", null, parsed ) )
1480 {
1481 javaFeatures.setSubClass2( parseSubClassLevel2( parser, strict ) );
1482 }
1483 else if ( checkFieldWithDuplicate( parser, "subClass3", null, parsed ) )
1484 {
1485 javaFeatures.setSubClass3( parseSubClassLevel3( parser, strict ) );
1486 }
1487 else if ( checkFieldWithDuplicate( parser, "annotation", null, parsed ) )
1488 {
1489 javaFeatures.setAnnotation( parseAnnotationTest( parser, strict ) );
1490 }
1491 else
1492 {
1493 checkUnknownElement( parser, strict );
1494 }
1495 }
1496 return javaFeatures;
1497 }
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509 private NodeItem parseNodeItem( XmlPullParser parser, boolean strict )
1510 throws IOException, XmlPullParserException
1511 {
1512 String tagName = parser.getName();
1513 NodeItemst/features/NodeItem.html#NodeItem">NodeItem nodeItem = new NodeItem();
1514 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1515 {
1516 String name = parser.getAttributeName( i );
1517 String value = parser.getAttributeValue( i );
1518
1519 if ( name.indexOf( ':' ) >= 0 )
1520 {
1521
1522 }
1523 else
1524 {
1525 checkUnknownAttribute( parser, name, tagName, strict );
1526 }
1527 }
1528 java.util.Set<String> parsed = new java.util.HashSet<String>();
1529 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1530 {
1531 if ( checkFieldWithDuplicate( parser, "value", null, parsed ) )
1532 {
1533 nodeItem.setValue( interpolatedTrimmed( parser.nextText(), "value" ) );
1534 }
1535 else if ( checkFieldWithDuplicate( parser, "child", null, parsed ) )
1536 {
1537 nodeItem.setChild( parseNodeItem( parser, strict ) );
1538 }
1539 else
1540 {
1541 checkUnknownElement( parser, strict );
1542 }
1543 }
1544 return nodeItem;
1545 }
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557 private PackageNameFeature parsePackageNameFeature( XmlPullParser parser, boolean strict )
1558 throws IOException, XmlPullParserException
1559 {
1560 String tagName = parser.getName();
1561 PackageNameFeatureckageNameFeature.html#PackageNameFeature">PackageNameFeature packageNameFeature = new PackageNameFeature();
1562 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1563 {
1564 String name = parser.getAttributeName( i );
1565 String value = parser.getAttributeValue( i );
1566
1567 if ( name.indexOf( ':' ) >= 0 )
1568 {
1569
1570 }
1571 else
1572 {
1573 checkUnknownAttribute( parser, name, tagName, strict );
1574 }
1575 }
1576 java.util.Set<String> parsed = new java.util.HashSet<String>();
1577 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1578 {
1579 if ( checkFieldWithDuplicate( parser, "reference", null, parsed ) )
1580 {
1581 packageNameFeature.setReference( parseReference( parser, strict ) );
1582 }
1583 else
1584 {
1585 checkUnknownElement( parser, strict );
1586 }
1587 }
1588 return packageNameFeature;
1589 }
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601 private Reference parseReference( XmlPullParser parser, boolean strict )
1602 throws IOException, XmlPullParserException
1603 {
1604 String tagName = parser.getName();
1605 Reference/features/Reference.html#Reference">Reference reference = new Reference();
1606 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1607 {
1608 String name = parser.getAttributeName( i );
1609 String value = parser.getAttributeValue( i );
1610
1611 if ( name.indexOf( ':' ) >= 0 )
1612 {
1613
1614 }
1615 else
1616 {
1617 checkUnknownAttribute( parser, name, tagName, strict );
1618 }
1619 }
1620 java.util.Set<String> parsed = new java.util.HashSet<String>();
1621 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1622 {
1623 if ( checkFieldWithDuplicate( parser, "id", "key", parsed ) )
1624 {
1625 reference.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
1626 }
1627 else
1628 {
1629 checkUnknownElement( parser, strict );
1630 }
1631 }
1632 return reference;
1633 }
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645 private SimpleTypes parseSimpleTypes( XmlPullParser parser, boolean strict )
1646 throws IOException, XmlPullParserException
1647 {
1648 String tagName = parser.getName();
1649 SimpleTypestures/SimpleTypes.html#SimpleTypes">SimpleTypes simpleTypes = new SimpleTypes();
1650 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1651 {
1652 String name = parser.getAttributeName( i );
1653 String value = parser.getAttributeValue( i );
1654
1655 if ( name.indexOf( ':' ) >= 0 )
1656 {
1657
1658 }
1659 else
1660 {
1661 checkUnknownAttribute( parser, name, tagName, strict );
1662 }
1663 }
1664 java.util.Set<String> parsed = new java.util.HashSet<String>();
1665 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1666 {
1667 if ( checkFieldWithDuplicate( parser, "primitiveBoolean", null, parsed ) )
1668 {
1669 simpleTypes.setPrimitiveBoolean( getBooleanValue( interpolatedTrimmed( parser.nextText(), "primitiveBoolean" ), "primitiveBoolean", parser, "true" ) );
1670 }
1671 else if ( checkFieldWithDuplicate( parser, "primitiveChar", null, parsed ) )
1672 {
1673 simpleTypes.setPrimitiveChar( getCharacterValue( interpolatedTrimmed( parser.nextText(), "primitiveChar" ), "primitiveChar", parser ) );
1674 }
1675 else if ( checkFieldWithDuplicate( parser, "primitiveByte", null, parsed ) )
1676 {
1677 simpleTypes.setPrimitiveByte( getByteValue( interpolatedTrimmed( parser.nextText(), "primitiveByte" ), "primitiveByte", parser, strict ) );
1678 }
1679 else if ( checkFieldWithDuplicate( parser, "primitiveShort", null, parsed ) )
1680 {
1681 simpleTypes.setPrimitiveShort( getShortValue( interpolatedTrimmed( parser.nextText(), "primitiveShort" ), "primitiveShort", parser, strict ) );
1682 }
1683 else if ( checkFieldWithDuplicate( parser, "primitiveInt", null, parsed ) )
1684 {
1685 simpleTypes.setPrimitiveInt( getIntegerValue( interpolatedTrimmed( parser.nextText(), "primitiveInt" ), "primitiveInt", parser, strict ) );
1686 }
1687 else if ( checkFieldWithDuplicate( parser, "primitiveLong", null, parsed ) )
1688 {
1689 simpleTypes.setPrimitiveLong( getLongValue( interpolatedTrimmed( parser.nextText(), "primitiveLong" ), "primitiveLong", parser, strict ) );
1690 }
1691 else if ( checkFieldWithDuplicate( parser, "primitiveFloat", null, parsed ) )
1692 {
1693 simpleTypes.setPrimitiveFloat( getFloatValue( interpolatedTrimmed( parser.nextText(), "primitiveFloat" ), "primitiveFloat", parser, strict ) );
1694 }
1695 else if ( checkFieldWithDuplicate( parser, "primitiveDouble", null, parsed ) )
1696 {
1697 simpleTypes.setPrimitiveDouble( getDoubleValue( interpolatedTrimmed( parser.nextText(), "primitiveDouble" ), "primitiveDouble", parser, strict ) );
1698 }
1699 else if ( checkFieldWithDuplicate( parser, "objectString", null, parsed ) )
1700 {
1701 simpleTypes.setObjectString( interpolatedTrimmed( parser.nextText(), "objectString" ) );
1702 }
1703 else if ( checkFieldWithDuplicate( parser, "objectDate", null, parsed ) )
1704 {
1705 String dateFormat = null;
1706 simpleTypes.setObjectDate( getDateValue( interpolatedTrimmed( parser.nextText(), "objectDate" ), "objectDate", dateFormat, parser ) );
1707 }
1708 else if ( checkFieldWithDuplicate( parser, "primitiveBooleanNoDefault", null, parsed ) )
1709 {
1710 simpleTypes.setPrimitiveBooleanNoDefault( getBooleanValue( interpolatedTrimmed( parser.nextText(), "primitiveBooleanNoDefault" ), "primitiveBooleanNoDefault", parser, "false" ) );
1711 }
1712 else if ( checkFieldWithDuplicate( parser, "primitiveCharNoDefault", null, parsed ) )
1713 {
1714 simpleTypes.setPrimitiveCharNoDefault( getCharacterValue( interpolatedTrimmed( parser.nextText(), "primitiveCharNoDefault" ), "primitiveCharNoDefault", parser ) );
1715 }
1716 else if ( checkFieldWithDuplicate( parser, "primitiveByteNoDefault", null, parsed ) )
1717 {
1718 simpleTypes.setPrimitiveByteNoDefault( getByteValue( interpolatedTrimmed( parser.nextText(), "primitiveByteNoDefault" ), "primitiveByteNoDefault", parser, strict ) );
1719 }
1720 else if ( checkFieldWithDuplicate( parser, "primitiveShortNoDefault", null, parsed ) )
1721 {
1722 simpleTypes.setPrimitiveShortNoDefault( getShortValue( interpolatedTrimmed( parser.nextText(), "primitiveShortNoDefault" ), "primitiveShortNoDefault", parser, strict ) );
1723 }
1724 else if ( checkFieldWithDuplicate( parser, "primitiveIntNoDefault", null, parsed ) )
1725 {
1726 simpleTypes.setPrimitiveIntNoDefault( getIntegerValue( interpolatedTrimmed( parser.nextText(), "primitiveIntNoDefault" ), "primitiveIntNoDefault", parser, strict ) );
1727 }
1728 else if ( checkFieldWithDuplicate( parser, "primitiveLongNoDefault", null, parsed ) )
1729 {
1730 simpleTypes.setPrimitiveLongNoDefault( getLongValue( interpolatedTrimmed( parser.nextText(), "primitiveLongNoDefault" ), "primitiveLongNoDefault", parser, strict ) );
1731 }
1732 else if ( checkFieldWithDuplicate( parser, "primitiveFloatNoDefault", null, parsed ) )
1733 {
1734 simpleTypes.setPrimitiveFloatNoDefault( getFloatValue( interpolatedTrimmed( parser.nextText(), "primitiveFloatNoDefault" ), "primitiveFloatNoDefault", parser, strict ) );
1735 }
1736 else if ( checkFieldWithDuplicate( parser, "primitiveDoubleNoDefault", null, parsed ) )
1737 {
1738 simpleTypes.setPrimitiveDoubleNoDefault( getDoubleValue( interpolatedTrimmed( parser.nextText(), "primitiveDoubleNoDefault" ), "primitiveDoubleNoDefault", parser, strict ) );
1739 }
1740 else if ( checkFieldWithDuplicate( parser, "objectStringNoDefault", null, parsed ) )
1741 {
1742 simpleTypes.setObjectStringNoDefault( interpolatedTrimmed( parser.nextText(), "objectStringNoDefault" ) );
1743 }
1744 else if ( checkFieldWithDuplicate( parser, "objectDateNoDefault", null, parsed ) )
1745 {
1746 String dateFormat = null;
1747 simpleTypes.setObjectDateNoDefault( getDateValue( interpolatedTrimmed( parser.nextText(), "objectDateNoDefault" ), "objectDateNoDefault", dateFormat, parser ) );
1748 }
1749 else if ( checkFieldWithDuplicate( parser, "dom", null, parsed ) )
1750 {
1751 simpleTypes.setDom( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
1752 }
1753 else if ( checkFieldWithDuplicate( parser, "content", null, parsed ) )
1754 {
1755 simpleTypes.setContent( parseContentTest( parser, strict ) );
1756 }
1757 else
1758 {
1759 checkUnknownElement( parser, strict );
1760 }
1761 }
1762 return simpleTypes;
1763 }
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775 private SubClassLevel1 parseSubClassLevel1( XmlPullParser parser, boolean strict )
1776 throws IOException, XmlPullParserException
1777 {
1778 String tagName = parser.getName();
1779 SubClassLevel1SubClassLevel1.html#SubClassLevel1">SubClassLevel1 subClassLevel1 = new SubClassLevel1();
1780 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1781 {
1782 String name = parser.getAttributeName( i );
1783 String value = parser.getAttributeValue( i );
1784
1785 if ( name.indexOf( ':' ) >= 0 )
1786 {
1787
1788 }
1789 else if ( "subAttribute1".equals( name ) )
1790 {
1791 subClassLevel1.setSubAttribute1( getLongValue( interpolatedTrimmed( value, "subAttribute1" ), "subAttribute1", parser, strict ) );
1792 }
1793 else if ( "baseAttribute".equals( name ) )
1794 {
1795 subClassLevel1.setBaseAttribute( getIntegerValue( interpolatedTrimmed( value, "baseAttribute" ), "baseAttribute", parser, strict ) );
1796 }
1797 else
1798 {
1799 checkUnknownAttribute( parser, name, tagName, strict );
1800 }
1801 }
1802 java.util.Set<String> parsed = new java.util.HashSet<String>();
1803 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1804 {
1805 if ( checkFieldWithDuplicate( parser, "subElement1", null, parsed ) )
1806 {
1807 subClassLevel1.setSubElement1( getLongValue( interpolatedTrimmed( parser.nextText(), "subElement1" ), "subElement1", parser, strict ) );
1808 }
1809 else if ( checkFieldWithDuplicate( parser, "baseElement", null, parsed ) )
1810 {
1811 subClassLevel1.setBaseElement( getIntegerValue( interpolatedTrimmed( parser.nextText(), "baseElement" ), "baseElement", parser, strict ) );
1812 }
1813 else
1814 {
1815 checkUnknownElement( parser, strict );
1816 }
1817 }
1818 return subClassLevel1;
1819 }
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831 private SubClassLevel2 parseSubClassLevel2( XmlPullParser parser, boolean strict )
1832 throws IOException, XmlPullParserException
1833 {
1834 String tagName = parser.getName();
1835 SubClassLevel2SubClassLevel2.html#SubClassLevel2">SubClassLevel2 subClassLevel2 = new SubClassLevel2();
1836 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1837 {
1838 String name = parser.getAttributeName( i );
1839 String value = parser.getAttributeValue( i );
1840
1841 if ( name.indexOf( ':' ) >= 0 )
1842 {
1843
1844 }
1845 else if ( "subAttribute2".equals( name ) )
1846 {
1847 subClassLevel2.setSubAttribute2( getFloatValue( interpolatedTrimmed( value, "subAttribute2" ), "subAttribute2", parser, strict ) );
1848 }
1849 else if ( "subAttribute1".equals( name ) )
1850 {
1851 subClassLevel2.setSubAttribute1( getLongValue( interpolatedTrimmed( value, "subAttribute1" ), "subAttribute1", parser, strict ) );
1852 }
1853 else if ( "baseAttribute".equals( name ) )
1854 {
1855 subClassLevel2.setBaseAttribute( getIntegerValue( interpolatedTrimmed( value, "baseAttribute" ), "baseAttribute", parser, strict ) );
1856 }
1857 else
1858 {
1859 checkUnknownAttribute( parser, name, tagName, strict );
1860 }
1861 }
1862 java.util.Set<String> parsed = new java.util.HashSet<String>();
1863 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1864 {
1865 if ( checkFieldWithDuplicate( parser, "subElement2", null, parsed ) )
1866 {
1867 subClassLevel2.setSubElement2( getFloatValue( interpolatedTrimmed( parser.nextText(), "subElement2" ), "subElement2", parser, strict ) );
1868 }
1869 else if ( checkFieldWithDuplicate( parser, "subElement1", null, parsed ) )
1870 {
1871 subClassLevel2.setSubElement1( getLongValue( interpolatedTrimmed( parser.nextText(), "subElement1" ), "subElement1", parser, strict ) );
1872 }
1873 else if ( checkFieldWithDuplicate( parser, "baseElement", null, parsed ) )
1874 {
1875 subClassLevel2.setBaseElement( getIntegerValue( interpolatedTrimmed( parser.nextText(), "baseElement" ), "baseElement", parser, strict ) );
1876 }
1877 else
1878 {
1879 checkUnknownElement( parser, strict );
1880 }
1881 }
1882 return subClassLevel2;
1883 }
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895 private SubClassLevel3 parseSubClassLevel3( XmlPullParser parser, boolean strict )
1896 throws IOException, XmlPullParserException
1897 {
1898 String tagName = parser.getName();
1899 SubClassLevel3SubClassLevel3.html#SubClassLevel3">SubClassLevel3 subClassLevel3 = new SubClassLevel3();
1900 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1901 {
1902 String name = parser.getAttributeName( i );
1903 String value = parser.getAttributeValue( i );
1904
1905 if ( name.indexOf( ':' ) >= 0 )
1906 {
1907
1908 }
1909 else if ( "subAttribute3".equals( name ) )
1910 {
1911 subClassLevel3.setSubAttribute3( getDoubleValue( interpolatedTrimmed( value, "subAttribute3" ), "subAttribute3", parser, strict ) );
1912 }
1913 else if ( "subAttribute2".equals( name ) )
1914 {
1915 subClassLevel3.setSubAttribute2( getFloatValue( interpolatedTrimmed( value, "subAttribute2" ), "subAttribute2", parser, strict ) );
1916 }
1917 else if ( "subAttribute1".equals( name ) )
1918 {
1919 subClassLevel3.setSubAttribute1( getLongValue( interpolatedTrimmed( value, "subAttribute1" ), "subAttribute1", parser, strict ) );
1920 }
1921 else if ( "baseAttribute".equals( name ) )
1922 {
1923 subClassLevel3.setBaseAttribute( getIntegerValue( interpolatedTrimmed( value, "baseAttribute" ), "baseAttribute", parser, strict ) );
1924 }
1925 else
1926 {
1927 checkUnknownAttribute( parser, name, tagName, strict );
1928 }
1929 }
1930 java.util.Set<String> parsed = new java.util.HashSet<String>();
1931 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1932 {
1933 if ( checkFieldWithDuplicate( parser, "subElement3", null, parsed ) )
1934 {
1935 subClassLevel3.setSubElement3( getDoubleValue( interpolatedTrimmed( parser.nextText(), "subElement3" ), "subElement3", parser, strict ) );
1936 }
1937 else if ( checkFieldWithDuplicate( parser, "subElement2", null, parsed ) )
1938 {
1939 subClassLevel3.setSubElement2( getFloatValue( interpolatedTrimmed( parser.nextText(), "subElement2" ), "subElement2", parser, strict ) );
1940 }
1941 else if ( checkFieldWithDuplicate( parser, "subElement1", null, parsed ) )
1942 {
1943 subClassLevel3.setSubElement1( getLongValue( interpolatedTrimmed( parser.nextText(), "subElement1" ), "subElement1", parser, strict ) );
1944 }
1945 else if ( checkFieldWithDuplicate( parser, "baseElement", null, parsed ) )
1946 {
1947 subClassLevel3.setBaseElement( getIntegerValue( interpolatedTrimmed( parser.nextText(), "baseElement" ), "baseElement", parser, strict ) );
1948 }
1949 else
1950 {
1951 checkUnknownElement( parser, strict );
1952 }
1953 }
1954 return subClassLevel3;
1955 }
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967 private SuperThing parseSuperThing( XmlPullParser parser, boolean strict )
1968 throws IOException, XmlPullParserException
1969 {
1970 String tagName = parser.getName();
1971 SuperThingeatures/SuperThing.html#SuperThing">SuperThing superThing = new SuperThing();
1972 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1973 {
1974 String name = parser.getAttributeName( i );
1975 String value = parser.getAttributeValue( i );
1976
1977 if ( name.indexOf( ':' ) >= 0 )
1978 {
1979
1980 }
1981 else
1982 {
1983 checkUnknownAttribute( parser, name, tagName, strict );
1984 }
1985 }
1986 java.util.Set<String> parsed = new java.util.HashSet<String>();
1987 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1988 {
1989 checkUnknownElement( parser, strict );
1990 }
1991 return superThing;
1992 }
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004 private Thing parseThing( XmlPullParser parser, boolean strict )
2005 throws IOException, XmlPullParserException
2006 {
2007 String tagName = parser.getName();
2008 Thingllo/test/features/Thing.html#Thing">Thing thing = new Thing();
2009 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2010 {
2011 String name = parser.getAttributeName( i );
2012 String value = parser.getAttributeValue( i );
2013
2014 if ( name.indexOf( ':' ) >= 0 )
2015 {
2016
2017 }
2018 else
2019 {
2020 checkUnknownAttribute( parser, name, tagName, strict );
2021 }
2022 }
2023 java.util.Set<String> parsed = new java.util.HashSet<String>();
2024 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2025 {
2026 if ( checkFieldWithDuplicate( parser, "someBoolean", null, parsed ) )
2027 {
2028 thing.setSomeBoolean( getBooleanValue( interpolatedTrimmed( parser.nextText(), "someBoolean" ), "someBoolean", parser, "false" ) );
2029 }
2030 else if ( checkFieldWithDuplicate( parser, "someChar", null, parsed ) )
2031 {
2032 thing.setSomeChar( getCharacterValue( interpolatedTrimmed( parser.nextText(), "someChar" ), "someChar", parser ) );
2033 }
2034 else if ( checkFieldWithDuplicate( parser, "someByte", null, parsed ) )
2035 {
2036 thing.setSomeByte( getByteValue( interpolatedTrimmed( parser.nextText(), "someByte" ), "someByte", parser, strict ) );
2037 }
2038 else if ( checkFieldWithDuplicate( parser, "someShort", null, parsed ) )
2039 {
2040 thing.setSomeShort( getShortValue( interpolatedTrimmed( parser.nextText(), "someShort" ), "someShort", parser, strict ) );
2041 }
2042 else if ( checkFieldWithDuplicate( parser, "someInt", null, parsed ) )
2043 {
2044 thing.setSomeInt( getIntegerValue( interpolatedTrimmed( parser.nextText(), "someInt" ), "someInt", parser, strict ) );
2045 }
2046 else if ( checkFieldWithDuplicate( parser, "someLong", null, parsed ) )
2047 {
2048 thing.setSomeLong( getLongValue( interpolatedTrimmed( parser.nextText(), "someLong" ), "someLong", parser, strict ) );
2049 }
2050 else if ( checkFieldWithDuplicate( parser, "someFloat", null, parsed ) )
2051 {
2052 thing.setSomeFloat( getFloatValue( interpolatedTrimmed( parser.nextText(), "someFloat" ), "someFloat", parser, strict ) );
2053 }
2054 else if ( checkFieldWithDuplicate( parser, "someDouble", null, parsed ) )
2055 {
2056 thing.setSomeDouble( getDoubleValue( interpolatedTrimmed( parser.nextText(), "someDouble" ), "someDouble", parser, strict ) );
2057 }
2058 else if ( checkFieldWithDuplicate( parser, "someString", null, parsed ) )
2059 {
2060 thing.setSomeString( interpolatedTrimmed( parser.nextText(), "someString" ) );
2061 }
2062 else if ( checkFieldWithDuplicate( parser, "someDate", null, parsed ) )
2063 {
2064 String dateFormat = null;
2065 thing.setSomeDate( getDateValue( interpolatedTrimmed( parser.nextText(), "someDate" ), "someDate", dateFormat, parser ) );
2066 }
2067 else if ( checkFieldWithDuplicate( parser, "someDom", null, parsed ) )
2068 {
2069 thing.setSomeDom( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
2070 }
2071 else if ( checkFieldWithDuplicate( parser, "someProperties", null, parsed ) )
2072 {
2073 while ( parser.nextTag() == XmlPullParser.START_TAG )
2074 {
2075 String key = parser.getName();
2076 String value = parser.nextText().trim();
2077 thing.addSomeProperty( key, value );
2078 }
2079 }
2080 else if ( checkFieldWithDuplicate( parser, "someStringList", null, parsed ) )
2081 {
2082 java.util.List<String> someStringList = new java.util.ArrayList<String>();
2083 while ( parser.nextTag() == XmlPullParser.START_TAG )
2084 {
2085 if ( "someStringList".equals( parser.getName() ) )
2086 {
2087 someStringList.add( interpolatedTrimmed( parser.nextText(), "someStringList" ) );
2088 }
2089 else
2090 {
2091 checkUnknownElement( parser, strict );
2092 }
2093 }
2094 thing.setSomeStringList( someStringList );
2095 }
2096 else if ( checkFieldWithDuplicate( parser, "someStringSet", null, parsed ) )
2097 {
2098 java.util.Set<String> someStringSet = new java.util.HashSet<String>();
2099 while ( parser.nextTag() == XmlPullParser.START_TAG )
2100 {
2101 if ( "someStringSet".equals( parser.getName() ) )
2102 {
2103 someStringSet.add( interpolatedTrimmed( parser.nextText(), "someStringSet" ) );
2104 }
2105 else
2106 {
2107 checkUnknownElement( parser, strict );
2108 }
2109 }
2110 thing.setSomeStringSet( someStringSet );
2111 }
2112 else if ( checkFieldWithDuplicate( parser, "deepThingy", null, parsed ) )
2113 {
2114 thing.setDeepThingy( parseThingy( parser, strict ) );
2115 }
2116 else if ( checkFieldWithDuplicate( parser, "deepThingyList", null, parsed ) )
2117 {
2118 java.util.List<Thingy> deepThingyList = new java.util.ArrayList<Thingy>();
2119 while ( parser.nextTag() == XmlPullParser.START_TAG )
2120 {
2121 if ( "deepThingyList".equals( parser.getName() ) )
2122 {
2123 deepThingyList.add( parseThingy( parser, strict ) );
2124 }
2125 else
2126 {
2127 checkUnknownElement( parser, strict );
2128 }
2129 }
2130 thing.setDeepThingyList( deepThingyList );
2131 }
2132 else if ( checkFieldWithDuplicate( parser, "deepThingySet", null, parsed ) )
2133 {
2134 java.util.Set<Thingy> deepThingySet = new java.util.HashSet<Thingy>();
2135 while ( parser.nextTag() == XmlPullParser.START_TAG )
2136 {
2137 if ( "deepThingySet".equals( parser.getName() ) )
2138 {
2139 deepThingySet.add( parseThingy( parser, strict ) );
2140 }
2141 else
2142 {
2143 checkUnknownElement( parser, strict );
2144 }
2145 }
2146 thing.setDeepThingySet( deepThingySet );
2147 }
2148 else if ( checkFieldWithDuplicate( parser, "shallowThingy", null, parsed ) )
2149 {
2150 thing.setShallowThingy( parseThingy( parser, strict ) );
2151 }
2152 else if ( checkFieldWithDuplicate( parser, "shallowThingyList", null, parsed ) )
2153 {
2154 java.util.List<Thingy> shallowThingyList = new java.util.ArrayList<Thingy>();
2155 while ( parser.nextTag() == XmlPullParser.START_TAG )
2156 {
2157 if ( "shallowThingyList".equals( parser.getName() ) )
2158 {
2159 shallowThingyList.add( parseThingy( parser, strict ) );
2160 }
2161 else
2162 {
2163 checkUnknownElement( parser, strict );
2164 }
2165 }
2166 thing.setShallowThingyList( shallowThingyList );
2167 }
2168 else if ( checkFieldWithDuplicate( parser, "shallowThingySet", null, parsed ) )
2169 {
2170 java.util.Set<Thingy> shallowThingySet = new java.util.HashSet<Thingy>();
2171 while ( parser.nextTag() == XmlPullParser.START_TAG )
2172 {
2173 if ( "shallowThingySet".equals( parser.getName() ) )
2174 {
2175 shallowThingySet.add( parseThingy( parser, strict ) );
2176 }
2177 else
2178 {
2179 checkUnknownElement( parser, strict );
2180 }
2181 }
2182 thing.setShallowThingySet( shallowThingySet );
2183 }
2184 else
2185 {
2186 checkUnknownElement( parser, strict );
2187 }
2188 }
2189 return thing;
2190 }
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202 private Thingy parseThingy( XmlPullParser parser, boolean strict )
2203 throws IOException, XmlPullParserException
2204 {
2205 String tagName = parser.getName();
2206 Thingyo/test/features/Thingy.html#Thingy">Thingy thingy = new Thingy();
2207 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2208 {
2209 String name = parser.getAttributeName( i );
2210 String value = parser.getAttributeValue( i );
2211
2212 if ( name.indexOf( ':' ) >= 0 )
2213 {
2214
2215 }
2216 else
2217 {
2218 checkUnknownAttribute( parser, name, tagName, strict );
2219 }
2220 }
2221 thingy.setSomeContent( interpolatedTrimmed( parser.nextText(), "someContent" ) );
2222 return thingy;
2223 }
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235 private XdocFeatures parseXdocFeatures( XmlPullParser parser, boolean strict )
2236 throws IOException, XmlPullParserException
2237 {
2238 String tagName = parser.getName();
2239 XdocFeaturesres/XdocFeatures.html#XdocFeatures">XdocFeatures xdocFeatures = new XdocFeatures();
2240 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2241 {
2242 String name = parser.getAttributeName( i );
2243 String value = parser.getAttributeValue( i );
2244
2245 if ( name.indexOf( ':' ) >= 0 )
2246 {
2247
2248 }
2249 else
2250 {
2251 checkUnknownAttribute( parser, name, tagName, strict );
2252 }
2253 }
2254 java.util.Set<String> parsed = new java.util.HashSet<String>();
2255 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2256 {
2257 if ( checkFieldWithDuplicate( parser, "field", null, parsed ) )
2258 {
2259 xdocFeatures.setField( interpolatedTrimmed( parser.nextText(), "field" ) );
2260 }
2261 else if ( checkFieldWithDuplicate( parser, "xdocSeparatorNone", null, parsed ) )
2262 {
2263 xdocFeatures.setXdocSeparatorNone( interpolatedTrimmed( parser.nextText(), "xdocSeparatorNone" ) );
2264 }
2265 else if ( checkFieldWithDuplicate( parser, "xdocSeparatorBlank", null, parsed ) )
2266 {
2267 xdocFeatures.setXdocSeparatorBlank( interpolatedTrimmed( parser.nextText(), "xdocSeparatorBlank" ) );
2268 }
2269 else
2270 {
2271 checkUnknownElement( parser, strict );
2272 }
2273 }
2274 return xdocFeatures;
2275 }
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287 private XmlAttributes parseXmlAttributes( XmlPullParser parser, boolean strict )
2288 throws IOException, XmlPullParserException
2289 {
2290 String tagName = parser.getName();
2291 XmlAttributess/XmlAttributes.html#XmlAttributes">XmlAttributes xmlAttributes = new XmlAttributes();
2292 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2293 {
2294 String name = parser.getAttributeName( i );
2295 String value = parser.getAttributeValue( i );
2296
2297 if ( name.indexOf( ':' ) >= 0 )
2298 {
2299
2300 }
2301 else if ( "primitiveBoolean".equals( name ) )
2302 {
2303 xmlAttributes.setPrimitiveBoolean( getBooleanValue( interpolatedTrimmed( value, "primitiveBoolean" ), "primitiveBoolean", parser, "true" ) );
2304 }
2305 else if ( "primitiveChar".equals( name ) )
2306 {
2307 xmlAttributes.setPrimitiveChar( getCharacterValue( interpolatedTrimmed( value, "primitiveChar" ), "primitiveChar", parser ) );
2308 }
2309 else if ( "primitiveByte".equals( name ) )
2310 {
2311 xmlAttributes.setPrimitiveByte( getByteValue( interpolatedTrimmed( value, "primitiveByte" ), "primitiveByte", parser, strict ) );
2312 }
2313 else if ( "primitiveShort".equals( name ) )
2314 {
2315 xmlAttributes.setPrimitiveShort( getShortValue( interpolatedTrimmed( value, "primitiveShort" ), "primitiveShort", parser, strict ) );
2316 }
2317 else if ( "primitiveInt".equals( name ) )
2318 {
2319 xmlAttributes.setPrimitiveInt( getIntegerValue( interpolatedTrimmed( value, "primitiveInt" ), "primitiveInt", parser, strict ) );
2320 }
2321 else if ( "primitiveLong".equals( name ) )
2322 {
2323 xmlAttributes.setPrimitiveLong( getLongValue( interpolatedTrimmed( value, "primitiveLong" ), "primitiveLong", parser, strict ) );
2324 }
2325 else if ( "primitiveFloat".equals( name ) )
2326 {
2327 xmlAttributes.setPrimitiveFloat( getFloatValue( interpolatedTrimmed( value, "primitiveFloat" ), "primitiveFloat", parser, strict ) );
2328 }
2329 else if ( "primitiveDouble".equals( name ) )
2330 {
2331 xmlAttributes.setPrimitiveDouble( getDoubleValue( interpolatedTrimmed( value, "primitiveDouble" ), "primitiveDouble", parser, strict ) );
2332 }
2333 else if ( "objectString".equals( name ) )
2334 {
2335 xmlAttributes.setObjectString( interpolatedTrimmed( value, "objectString" ) );
2336 }
2337 else if ( "objectDate".equals( name ) )
2338 {
2339 String dateFormat = null;
2340 xmlAttributes.setObjectDate( getDateValue( interpolatedTrimmed( value, "objectDate" ), "objectDate", dateFormat, parser ) );
2341 }
2342 else if ( "tag-name".equals( name ) )
2343 {
2344 xmlAttributes.setAttribute( interpolatedTrimmed( value, "tag-name" ) );
2345 }
2346 else
2347 {
2348 checkUnknownAttribute( parser, name, tagName, strict );
2349 }
2350 }
2351 java.util.Set<String> parsed = new java.util.HashSet<String>();
2352 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2353 {
2354 checkUnknownElement( parser, strict );
2355 }
2356 return xmlAttributes;
2357 }
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369 private XmlContent parseXmlContent( XmlPullParser parser, boolean strict )
2370 throws IOException, XmlPullParserException
2371 {
2372 String tagName = parser.getName();
2373 XmlContenteatures/XmlContent.html#XmlContent">XmlContent xmlContent = new XmlContent();
2374 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2375 {
2376 String name = parser.getAttributeName( i );
2377 String value = parser.getAttributeValue( i );
2378
2379 if ( name.indexOf( ':' ) >= 0 )
2380 {
2381
2382 }
2383 else
2384 {
2385 checkUnknownAttribute( parser, name, tagName, strict );
2386 }
2387 }
2388 java.util.Set<String> parsed = new java.util.HashSet<String>();
2389 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2390 {
2391 if ( checkFieldWithDuplicate( parser, "content.long", null, parsed ) )
2392 {
2393 xmlContent.setLongContent( parseXmlContentLong( parser, strict ) );
2394 }
2395 else if ( checkFieldWithDuplicate( parser, "content.long-with-attributes", null, parsed ) )
2396 {
2397 xmlContent.setLongContentWithAttributes( parseXmlContentLongWithAttributes( parser, strict ) );
2398 }
2399 else
2400 {
2401 checkUnknownElement( parser, strict );
2402 }
2403 }
2404 return xmlContent;
2405 }
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417 private XmlContentLong parseXmlContentLong( XmlPullParser parser, boolean strict )
2418 throws IOException, XmlPullParserException
2419 {
2420 String tagName = parser.getName();
2421 XmlContentLongXmlContentLong.html#XmlContentLong">XmlContentLong xmlContentLong = new XmlContentLong();
2422 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2423 {
2424 String name = parser.getAttributeName( i );
2425 String value = parser.getAttributeValue( i );
2426
2427 if ( name.indexOf( ':' ) >= 0 )
2428 {
2429
2430 }
2431 else
2432 {
2433 checkUnknownAttribute( parser, name, tagName, strict );
2434 }
2435 }
2436 xmlContentLong.setContent( getLongValue( interpolatedTrimmed( parser.nextText(), "content" ), "content", parser, strict ) );
2437 return xmlContentLong;
2438 }
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450 private XmlContentLongWithAttributes parseXmlContentLongWithAttributes( XmlPullParser parser, boolean strict )
2451 throws IOException, XmlPullParserException
2452 {
2453 String tagName = parser.getName();
2454 XmlContentLongWithAttributes.html#XmlContentLongWithAttributes">XmlContentLongWithAttributes xmlContentLongWithAttributes = new XmlContentLongWithAttributes();
2455 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2456 {
2457 String name = parser.getAttributeName( i );
2458 String value = parser.getAttributeValue( i );
2459
2460 if ( name.indexOf( ':' ) >= 0 )
2461 {
2462
2463 }
2464 else if ( "attr".equals( name ) )
2465 {
2466 xmlContentLongWithAttributes.setAttr( interpolatedTrimmed( value, "attr" ) );
2467 }
2468 else if ( "attr2".equals( name ) )
2469 {
2470 xmlContentLongWithAttributes.setAttr2( getIntegerValue( interpolatedTrimmed( value, "attr2" ), "attr2", parser, strict ) );
2471 }
2472 else
2473 {
2474 checkUnknownAttribute( parser, name, tagName, strict );
2475 }
2476 }
2477 xmlContentLongWithAttributes.setContent( getLongValue( interpolatedTrimmed( parser.nextText(), "content" ), "content", parser, strict ) );
2478 return xmlContentLongWithAttributes;
2479 }
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491 private XmlFeatures parseXmlFeatures( XmlPullParser parser, boolean strict )
2492 throws IOException, XmlPullParserException
2493 {
2494 String tagName = parser.getName();
2495 XmlFeaturestures/XmlFeatures.html#XmlFeatures">XmlFeatures xmlFeatures = new XmlFeatures();
2496 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2497 {
2498 String name = parser.getAttributeName( i );
2499 String value = parser.getAttributeValue( i );
2500
2501 if ( name.indexOf( ':' ) >= 0 )
2502 {
2503
2504 }
2505 else if ( "tag-name.attribute".equals( name ) )
2506 {
2507 xmlFeatures.setFieldNameAttribute( interpolatedTrimmed( value, "tag-name.attribute" ) );
2508 }
2509 else
2510 {
2511 checkUnknownAttribute( parser, name, tagName, strict );
2512 }
2513 }
2514 java.util.Set<String> parsed = new java.util.HashSet<String>();
2515 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2516 {
2517 if ( checkFieldWithDuplicate( parser, "attributes", null, parsed ) )
2518 {
2519 xmlFeatures.setAttributes( parseXmlAttributes( parser, strict ) );
2520 }
2521 else if ( checkFieldWithDuplicate( parser, "attributesDefault", null, parsed ) )
2522 {
2523 xmlFeatures.setAttributesDefault( parseXmlAttributes( parser, strict ) );
2524 }
2525 else if ( checkFieldWithDuplicate( parser, "content", null, parsed ) )
2526 {
2527 xmlFeatures.setContent( parseXmlContent( parser, strict ) );
2528 }
2529 else if ( checkFieldWithDuplicate( parser, "fieldTrim", null, parsed ) )
2530 {
2531 xmlFeatures.setFieldTrim( interpolatedTrimmed( parser.nextText(), "fieldTrim" ) );
2532 }
2533 else if ( checkFieldWithDuplicate( parser, "fieldNoTrim", null, parsed ) )
2534 {
2535 xmlFeatures.setFieldNoTrim( parser.nextText() );
2536 }
2537 else if ( checkFieldWithDuplicate( parser, "dom", null, parsed ) )
2538 {
2539 xmlFeatures.setDom( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
2540 }
2541 else if ( checkFieldWithDuplicate( parser, "domNoTrim", null, parsed ) )
2542 {
2543 xmlFeatures.setDomNoTrim( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, false ) );
2544 }
2545 else if ( checkFieldWithDuplicate( parser, "tag-name", null, parsed ) )
2546 {
2547 xmlFeatures.setFieldName( interpolatedTrimmed( parser.nextText(), "tag-name" ) );
2548 }
2549 else if ( checkFieldWithDuplicate( parser, "dateXmlFormat", null, parsed ) )
2550 {
2551 String dateFormat = "yyyy-MM-dd'T'HH:mm:ss";
2552 xmlFeatures.setDateXmlFormat( getDateValue( interpolatedTrimmed( parser.nextText(), "dateXmlFormat" ), "dateXmlFormat", dateFormat, parser ) );
2553 }
2554 else if ( checkFieldWithDuplicate( parser, "dateLong", null, parsed ) )
2555 {
2556 String dateFormat = "long";
2557 xmlFeatures.setDateLong( getDateValue( interpolatedTrimmed( parser.nextText(), "dateLong" ), "dateLong", dateFormat, parser ) );
2558 }
2559 else if ( "xmlItemsStyleFlat".equals( parser.getName() ) )
2560 {
2561 java.util.List<Reference> xmlItemsStyleFlats = xmlFeatures.getXmlItemsStyleFlats();
2562 if ( xmlItemsStyleFlats == null )
2563 {
2564 xmlItemsStyleFlats = new java.util.ArrayList<Reference>();
2565 }
2566 xmlItemsStyleFlats.add( parseReference( parser, strict ) );
2567 xmlFeatures.setXmlItemsStyleFlats( xmlItemsStyleFlats );
2568 }
2569 else if ( checkFieldWithDuplicate( parser, "xmlAssociationTagNames", null, parsed ) )
2570 {
2571 java.util.List<Reference> xmlAssociationTagNames = new java.util.ArrayList<Reference>();
2572 while ( parser.nextTag() == XmlPullParser.START_TAG )
2573 {
2574 if ( "association.tag-name".equals( parser.getName() ) )
2575 {
2576 xmlAssociationTagNames.add( parseReference( parser, strict ) );
2577 }
2578 else
2579 {
2580 checkUnknownElement( parser, strict );
2581 }
2582 }
2583 xmlFeatures.setXmlAssociationTagNames( xmlAssociationTagNames );
2584 }
2585 else if ( checkFieldWithDuplicate( parser, "field.tag-names", null, parsed ) )
2586 {
2587 java.util.List<Reference> xmlTagNameAssociation = new java.util.ArrayList<Reference>();
2588 while ( parser.nextTag() == XmlPullParser.START_TAG )
2589 {
2590 if ( "field.tag-name".equals( parser.getName() ) )
2591 {
2592 xmlTagNameAssociation.add( parseReference( parser, strict ) );
2593 }
2594 else
2595 {
2596 checkUnknownElement( parser, strict );
2597 }
2598 }
2599 xmlFeatures.setXmlTagNameAssociation( xmlTagNameAssociation );
2600 }
2601 else if ( checkFieldWithDuplicate( parser, "field.tag-name", null, parsed ) )
2602 {
2603 java.util.List<Reference> xmlTagNameAssociationTagNames = new java.util.ArrayList<Reference>();
2604 while ( parser.nextTag() == XmlPullParser.START_TAG )
2605 {
2606 if ( "association.tag-name".equals( parser.getName() ) )
2607 {
2608 xmlTagNameAssociationTagNames.add( parseReference( parser, strict ) );
2609 }
2610 else
2611 {
2612 checkUnknownElement( parser, strict );
2613 }
2614 }
2615 xmlFeatures.setXmlTagNameAssociationTagNames( xmlTagNameAssociationTagNames );
2616 }
2617 else if ( "association.tag-name".equals( parser.getName() ) )
2618 {
2619 java.util.List<Reference> xmlFlatAssociationTagNames = xmlFeatures.getXmlFlatAssociationTagNames();
2620 if ( xmlFlatAssociationTagNames == null )
2621 {
2622 xmlFlatAssociationTagNames = new java.util.ArrayList<Reference>();
2623 }
2624 xmlFlatAssociationTagNames.add( parseReference( parser, strict ) );
2625 xmlFeatures.setXmlFlatAssociationTagNames( xmlFlatAssociationTagNames );
2626 }
2627 else if ( checkFieldWithDuplicate( parser, "explodeProperties", null, parsed ) )
2628 {
2629 while ( parser.nextTag() == XmlPullParser.START_TAG )
2630 {
2631 if ( "explodeProperty".equals( parser.getName() ) )
2632 {
2633 String key = null;
2634 String value = null;
2635
2636 while ( parser.nextTag() == XmlPullParser.START_TAG )
2637 {
2638 if ( "key".equals( parser.getName() ) )
2639 {
2640 key = parser.nextText();
2641 }
2642 else if ( "value".equals( parser.getName() ) )
2643 {
2644 value = parser.nextText().trim();
2645 }
2646 else
2647 {
2648 parser.nextText();
2649 }
2650 }
2651 xmlFeatures.addExplodeProperty( key, value );
2652 }
2653 parser.next();
2654 }
2655 }
2656 else if ( checkFieldWithDuplicate( parser, "inlineProperties", null, parsed ) )
2657 {
2658 while ( parser.nextTag() == XmlPullParser.START_TAG )
2659 {
2660 String key = parser.getName();
2661 String value = parser.nextText().trim();
2662 xmlFeatures.addInlineProperty( key, value );
2663 }
2664 }
2665 else if ( checkFieldWithDuplicate( parser, "xmlTransientFields", null, parsed ) )
2666 {
2667 xmlFeatures.setXmlTransientFields( parseXmlTransientFields( parser, strict ) );
2668 }
2669 else if ( checkFieldWithDuplicate( parser, "xmlFieldsOrder", null, parsed ) )
2670 {
2671 xmlFeatures.setXmlFieldsOrder( parseXmlFieldsOrder( parser, strict ) );
2672 }
2673 else if ( checkFieldWithDuplicate( parser, "xsdFeatures", null, parsed ) )
2674 {
2675 xmlFeatures.setXsdFeatures( parseXsdFeatures( parser, strict ) );
2676 }
2677 else
2678 {
2679 checkUnknownElement( parser, strict );
2680 }
2681 }
2682 return xmlFeatures;
2683 }
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695 private XmlFieldsOrder parseXmlFieldsOrder( XmlPullParser parser, boolean strict )
2696 throws IOException, XmlPullParserException
2697 {
2698 String tagName = parser.getName();
2699 XmlFieldsOrderXmlFieldsOrder.html#XmlFieldsOrder">XmlFieldsOrder xmlFieldsOrder = new XmlFieldsOrder();
2700 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2701 {
2702 String name = parser.getAttributeName( i );
2703 String value = parser.getAttributeValue( i );
2704
2705 if ( name.indexOf( ':' ) >= 0 )
2706 {
2707
2708 }
2709 else
2710 {
2711 checkUnknownAttribute( parser, name, tagName, strict );
2712 }
2713 }
2714 java.util.Set<String> parsed = new java.util.HashSet<String>();
2715 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2716 {
2717 if ( checkFieldWithDuplicate( parser, "field1", null, parsed ) )
2718 {
2719 xmlFieldsOrder.setField1( interpolatedTrimmed( parser.nextText(), "field1" ) );
2720 }
2721 else if ( checkFieldWithDuplicate( parser, "field-2", null, parsed ) )
2722 {
2723 xmlFieldsOrder.setField( interpolatedTrimmed( parser.nextText(), "field-2" ) );
2724 }
2725 else if ( checkFieldWithDuplicate( parser, "field3", null, parsed ) )
2726 {
2727 xmlFieldsOrder.setField3( interpolatedTrimmed( parser.nextText(), "field3" ) );
2728 }
2729 else if ( checkFieldWithDuplicate( parser, "field4", null, parsed ) )
2730 {
2731 xmlFieldsOrder.setField4( interpolatedTrimmed( parser.nextText(), "field4" ) );
2732 }
2733 else if ( checkFieldWithDuplicate( parser, "field5", null, parsed ) )
2734 {
2735 xmlFieldsOrder.setField5( interpolatedTrimmed( parser.nextText(), "field5" ) );
2736 }
2737 else if ( checkFieldWithDuplicate( parser, "field6", null, parsed ) )
2738 {
2739 xmlFieldsOrder.setField6( interpolatedTrimmed( parser.nextText(), "field6" ) );
2740 }
2741 else if ( checkFieldWithDuplicate( parser, "field7", null, parsed ) )
2742 {
2743 xmlFieldsOrder.setField7( interpolatedTrimmed( parser.nextText(), "field7" ) );
2744 }
2745 else
2746 {
2747 checkUnknownElement( parser, strict );
2748 }
2749 }
2750 return xmlFieldsOrder;
2751 }
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763 private XmlFieldsOrderParent parseXmlFieldsOrderParent( XmlPullParser parser, boolean strict )
2764 throws IOException, XmlPullParserException
2765 {
2766 String tagName = parser.getName();
2767 XmlFieldsOrderParenterParent.html#XmlFieldsOrderParent">XmlFieldsOrderParent xmlFieldsOrderParent = new XmlFieldsOrderParent();
2768 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2769 {
2770 String name = parser.getAttributeName( i );
2771 String value = parser.getAttributeValue( i );
2772
2773 if ( name.indexOf( ':' ) >= 0 )
2774 {
2775
2776 }
2777 else
2778 {
2779 checkUnknownAttribute( parser, name, tagName, strict );
2780 }
2781 }
2782 java.util.Set<String> parsed = new java.util.HashSet<String>();
2783 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2784 {
2785 if ( checkFieldWithDuplicate( parser, "field-2", null, parsed ) )
2786 {
2787 xmlFieldsOrderParent.setField( interpolatedTrimmed( parser.nextText(), "field-2" ) );
2788 }
2789 else if ( checkFieldWithDuplicate( parser, "field4", null, parsed ) )
2790 {
2791 xmlFieldsOrderParent.setField4( interpolatedTrimmed( parser.nextText(), "field4" ) );
2792 }
2793 else if ( checkFieldWithDuplicate( parser, "field5", null, parsed ) )
2794 {
2795 xmlFieldsOrderParent.setField5( interpolatedTrimmed( parser.nextText(), "field5" ) );
2796 }
2797 else if ( checkFieldWithDuplicate( parser, "field7", null, parsed ) )
2798 {
2799 xmlFieldsOrderParent.setField7( interpolatedTrimmed( parser.nextText(), "field7" ) );
2800 }
2801 else
2802 {
2803 checkUnknownElement( parser, strict );
2804 }
2805 }
2806 return xmlFieldsOrderParent;
2807 }
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819 private XmlFieldsOrderParent2 parseXmlFieldsOrderParent2( XmlPullParser parser, boolean strict )
2820 throws IOException, XmlPullParserException
2821 {
2822 String tagName = parser.getName();
2823 XmlFieldsOrderParent2Parent2.html#XmlFieldsOrderParent2">XmlFieldsOrderParent2 xmlFieldsOrderParent2 = new XmlFieldsOrderParent2();
2824 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2825 {
2826 String name = parser.getAttributeName( i );
2827 String value = parser.getAttributeValue( i );
2828
2829 if ( name.indexOf( ':' ) >= 0 )
2830 {
2831
2832 }
2833 else
2834 {
2835 checkUnknownAttribute( parser, name, tagName, strict );
2836 }
2837 }
2838 java.util.Set<String> parsed = new java.util.HashSet<String>();
2839 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2840 {
2841 if ( checkFieldWithDuplicate( parser, "field-2", null, parsed ) )
2842 {
2843 xmlFieldsOrderParent2.setField( interpolatedTrimmed( parser.nextText(), "field-2" ) );
2844 }
2845 else
2846 {
2847 checkUnknownElement( parser, strict );
2848 }
2849 }
2850 return xmlFieldsOrderParent2;
2851 }
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863 private XmlTransientFields parseXmlTransientFields( XmlPullParser parser, boolean strict )
2864 throws IOException, XmlPullParserException
2865 {
2866 String tagName = parser.getName();
2867 XmlTransientFieldsientFields.html#XmlTransientFields">XmlTransientFields xmlTransientFields = new XmlTransientFields();
2868 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2869 {
2870 String name = parser.getAttributeName( i );
2871 String value = parser.getAttributeValue( i );
2872
2873 if ( name.indexOf( ':' ) >= 0 )
2874 {
2875
2876 }
2877 else
2878 {
2879 checkUnknownAttribute( parser, name, tagName, strict );
2880 }
2881 }
2882 java.util.Set<String> parsed = new java.util.HashSet<String>();
2883 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2884 {
2885 if ( checkFieldWithDuplicate( parser, "persistentField", null, parsed ) )
2886 {
2887 xmlTransientFields.setPersistentField( interpolatedTrimmed( parser.nextText(), "persistentField" ) );
2888 }
2889 else
2890 {
2891 checkUnknownElement( parser, strict );
2892 }
2893 }
2894 return xmlTransientFields;
2895 }
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907 private XsdFeatures parseXsdFeatures( XmlPullParser parser, boolean strict )
2908 throws IOException, XmlPullParserException
2909 {
2910 String tagName = parser.getName();
2911 XsdFeaturestures/XsdFeatures.html#XsdFeatures">XsdFeatures xsdFeatures = new XsdFeatures();
2912 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2913 {
2914 String name = parser.getAttributeName( i );
2915 String value = parser.getAttributeValue( i );
2916
2917 if ( name.indexOf( ':' ) >= 0 )
2918 {
2919
2920 }
2921 else if ( "attribute".equals( name ) )
2922 {
2923 xsdFeatures.setAttribute( interpolatedTrimmed( value, "attribute" ) );
2924 }
2925 else
2926 {
2927 checkUnknownAttribute( parser, name, tagName, strict );
2928 }
2929 }
2930 java.util.Set<String> parsed = new java.util.HashSet<String>();
2931 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2932 {
2933 checkUnknownElement( parser, strict );
2934 }
2935 return xsdFeatures;
2936 }
2937
2938
2939
2940
2941
2942
2943 public void setAddDefaultEntities( boolean addDefaultEntities )
2944 {
2945 this.addDefaultEntities = addDefaultEntities;
2946 }
2947
2948 public static interface ContentTransformer
2949 {
2950
2951
2952
2953
2954
2955
2956
2957 String transform( String source, String fieldName );
2958 }
2959
2960 }