1
2
3
4
5
6 package org.apache.maven.plugins.assembly.model.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.apache.maven.plugins.assembly.model.Assembly;
17 import org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig;
18 import org.apache.maven.plugins.assembly.model.DependencySet;
19 import org.apache.maven.plugins.assembly.model.FileItem;
20 import org.apache.maven.plugins.assembly.model.FileSet;
21 import org.apache.maven.plugins.assembly.model.ModuleBinaries;
22 import org.apache.maven.plugins.assembly.model.ModuleSet;
23 import org.apache.maven.plugins.assembly.model.ModuleSources;
24 import org.apache.maven.plugins.assembly.model.UnpackOptions;
25 import org.codehaus.plexus.util.ReaderFactory;
26 import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
27 import org.codehaus.plexus.util.xml.pull.MXParser;
28 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
29 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
30
31
32
33
34
35
36 @SuppressWarnings( "all" )
37 public class AssemblyXpp3Reader
38 {
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 private boolean addDefaultEntities = true;
55
56
57
58
59 public final ContentTransformer contentTransformer;
60
61
62
63
64
65
66 public AssemblyXpp3Reader()
67 {
68 this( new ContentTransformer()
69 {
70 public String transform( String source, String fieldName )
71 {
72 return source;
73 }
74 } );
75 }
76
77 public AssemblyXpp3Reader(ContentTransformer contentTransformer)
78 {
79 this.contentTransformer = contentTransformer;
80 }
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
99 throws XmlPullParserException
100 {
101 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
102 {
103 return false;
104 }
105 if ( !parsed.add( tagName ) )
106 {
107 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
108 }
109 return true;
110 }
111
112
113
114
115
116
117
118
119
120
121
122
123 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
124 throws XmlPullParserException, IOException
125 {
126
127 if ( strict )
128 {
129 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
130 }
131 }
132
133
134
135
136
137
138
139
140
141
142 private void checkUnknownElement( XmlPullParser parser, boolean strict )
143 throws XmlPullParserException, IOException
144 {
145 if ( strict )
146 {
147 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
148 }
149
150 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
151 {
152 int eventType = parser.next();
153 if ( eventType == XmlPullParser.START_TAG )
154 {
155 unrecognizedTagCount++;
156 }
157 else if ( eventType == XmlPullParser.END_TAG )
158 {
159 unrecognizedTagCount--;
160 }
161 }
162 }
163
164
165
166
167
168
169 public boolean getAddDefaultEntities()
170 {
171 return addDefaultEntities;
172 }
173
174
175
176
177
178
179
180
181
182
183
184 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
185 throws XmlPullParserException
186 {
187 return getBooleanValue( s, attribute, parser, null );
188 }
189
190
191
192
193
194
195
196
197
198
199
200
201 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
202 throws XmlPullParserException
203 {
204 if ( s != null && s.length() != 0 )
205 {
206 return Boolean.valueOf( s ).booleanValue();
207 }
208 if ( defaultValue != null )
209 {
210 return Boolean.valueOf( defaultValue ).booleanValue();
211 }
212 return false;
213 }
214
215
216
217
218
219
220
221
222
223
224
225
226 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
227 throws XmlPullParserException
228 {
229 if ( s != null )
230 {
231 try
232 {
233 return Byte.valueOf( s ).byteValue();
234 }
235 catch ( NumberFormatException nfe )
236 {
237 if ( strict )
238 {
239 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
240 }
241 }
242 }
243 return 0;
244 }
245
246
247
248
249
250
251
252
253
254
255
256 private char getCharacterValue( String s, String attribute, XmlPullParser parser )
257 throws XmlPullParserException
258 {
259 if ( s != null )
260 {
261 return s.charAt( 0 );
262 }
263 return 0;
264 }
265
266
267
268
269
270
271
272
273
274
275
276 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
277 throws XmlPullParserException
278 {
279 return getDateValue( s, attribute, null, parser );
280 }
281
282
283
284
285
286
287
288
289
290
291
292
293 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
294 throws XmlPullParserException
295 {
296 if ( s != null )
297 {
298 String effectiveDateFormat = dateFormat;
299 if ( dateFormat == null )
300 {
301 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
302 }
303 if ( "long".equals( effectiveDateFormat ) )
304 {
305 try
306 {
307 return new java.util.Date( Long.parseLong( s ) );
308 }
309 catch ( NumberFormatException e )
310 {
311 throw new XmlPullParserException( e.getMessage(), parser, e );
312 }
313 }
314 else
315 {
316 try
317 {
318 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
319 return dateParser.parse( s );
320 }
321 catch ( java.text.ParseException e )
322 {
323 throw new XmlPullParserException( e.getMessage(), parser, e );
324 }
325 }
326 }
327 return null;
328 }
329
330
331
332
333
334
335
336
337
338
339
340
341 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
342 throws XmlPullParserException
343 {
344 if ( s != null )
345 {
346 try
347 {
348 return Double.valueOf( s ).doubleValue();
349 }
350 catch ( NumberFormatException nfe )
351 {
352 if ( strict )
353 {
354 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
355 }
356 }
357 }
358 return 0;
359 }
360
361
362
363
364
365
366
367
368
369
370
371
372 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
373 throws XmlPullParserException
374 {
375 if ( s != null )
376 {
377 try
378 {
379 return Float.valueOf( s ).floatValue();
380 }
381 catch ( NumberFormatException nfe )
382 {
383 if ( strict )
384 {
385 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
386 }
387 }
388 }
389 return 0;
390 }
391
392
393
394
395
396
397
398
399
400
401
402
403 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
404 throws XmlPullParserException
405 {
406 if ( s != null )
407 {
408 try
409 {
410 return Integer.valueOf( s ).intValue();
411 }
412 catch ( NumberFormatException nfe )
413 {
414 if ( strict )
415 {
416 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
417 }
418 }
419 }
420 return 0;
421 }
422
423
424
425
426
427
428
429
430
431
432
433
434 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
435 throws XmlPullParserException
436 {
437 if ( s != null )
438 {
439 try
440 {
441 return Long.valueOf( s ).longValue();
442 }
443 catch ( NumberFormatException nfe )
444 {
445 if ( strict )
446 {
447 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
448 }
449 }
450 }
451 return 0;
452 }
453
454
455
456
457
458
459
460
461
462
463
464
465 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
466 throws XmlPullParserException
467 {
468 if ( s == null )
469 {
470 if ( strict )
471 {
472 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
473 }
474 }
475 return s;
476 }
477
478
479
480
481
482
483
484
485
486
487
488
489 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
490 throws XmlPullParserException
491 {
492 if ( s != null )
493 {
494 try
495 {
496 return Short.valueOf( s ).shortValue();
497 }
498 catch ( NumberFormatException nfe )
499 {
500 if ( strict )
501 {
502 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
503 }
504 }
505 }
506 return 0;
507 }
508
509
510
511
512
513
514
515 private String getTrimmedValue( String s )
516 {
517 if ( s != null )
518 {
519 s = s.trim();
520 }
521 return s;
522 }
523
524
525
526
527
528
529
530
531 private String interpolatedTrimmed( String value, String context )
532 {
533 return getTrimmedValue( contentTransformer.transform( value, context ) );
534 }
535
536
537
538
539
540
541
542
543
544
545 private int nextTag( XmlPullParser parser )
546 throws IOException, XmlPullParserException
547 {
548 int eventType = parser.next();
549 if ( eventType == XmlPullParser.TEXT )
550 {
551 eventType = parser.next();
552 }
553 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
554 {
555 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
556 }
557 return eventType;
558 }
559
560
561
562
563
564
565
566
567
568
569
570 public Assembly read( XmlPullParser parser, boolean strict )
571 throws IOException, XmlPullParserException
572 {
573 Assembly assembly = null;
574 int eventType = parser.getEventType();
575 boolean parsed = false;
576 while ( eventType != XmlPullParser.END_DOCUMENT )
577 {
578 if ( eventType == XmlPullParser.START_TAG )
579 {
580 if ( strict && ! "assembly".equals( parser.getName() ) )
581 {
582 throw new XmlPullParserException( "Expected root element 'assembly' but found '" + parser.getName() + "'", parser, null );
583 }
584 else if ( parsed )
585 {
586
587 throw new XmlPullParserException( "Duplicated tag: 'assembly'", parser, null );
588 }
589 assembly = parseAssembly( parser, strict );
590 assembly.setModelEncoding( parser.getInputEncoding() );
591 parsed = true;
592 }
593 eventType = parser.next();
594 }
595 if ( parsed )
596 {
597 return assembly;
598 }
599 throw new XmlPullParserException( "Expected root element 'assembly' but found no element at all: invalid XML document", parser, null );
600 }
601
602
603
604
605
606
607
608
609
610
611
612 public Assembly read( Reader reader, boolean strict )
613 throws IOException, XmlPullParserException
614 {
615 XmlPullParser parser = addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser( );
616
617 parser.setInput( reader );
618
619
620 return read( parser, strict );
621 }
622
623
624
625
626
627
628
629
630
631
632 public Assembly read( Reader reader )
633 throws IOException, XmlPullParserException
634 {
635 return read( reader, true );
636 }
637
638
639
640
641
642
643
644
645
646
647
648 public Assembly read( InputStream in, boolean strict )
649 throws IOException, XmlPullParserException
650 {
651 return read( ReaderFactory.newXmlReader( in ), strict );
652 }
653
654
655
656
657
658
659
660
661
662
663 public Assembly read( InputStream in )
664 throws IOException, XmlPullParserException
665 {
666 return read( ReaderFactory.newXmlReader( in ) );
667 }
668
669
670
671
672
673
674
675
676
677
678
679 private Assembly parseAssembly( XmlPullParser parser, boolean strict )
680 throws IOException, XmlPullParserException
681 {
682 String tagName = parser.getName();
683 Assembly assembly = new Assembly();
684 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
685 {
686 String name = parser.getAttributeName( i );
687 String value = parser.getAttributeValue( i );
688
689 if ( name.indexOf( ':' ) >= 0 )
690 {
691
692 }
693 else if ( "xmlns".equals( name ) )
694 {
695
696 }
697 else
698 {
699 checkUnknownAttribute( parser, name, tagName, strict );
700 }
701 }
702 java.util.Set parsed = new java.util.HashSet();
703 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
704 {
705 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
706 {
707 assembly.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
708 }
709 else if ( checkFieldWithDuplicate( parser, "formats", null, parsed ) )
710 {
711 java.util.List<String> formats = new java.util.ArrayList<String>();
712 while ( parser.nextTag() == XmlPullParser.START_TAG )
713 {
714 if ( "format".equals( parser.getName() ) )
715 {
716 formats.add( interpolatedTrimmed( parser.nextText(), "formats" ) );
717 }
718 else
719 {
720 checkUnknownElement( parser, strict );
721 }
722 }
723 assembly.setFormats( formats );
724 }
725 else if ( checkFieldWithDuplicate( parser, "includeBaseDirectory", null, parsed ) )
726 {
727 assembly.setIncludeBaseDirectory( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeBaseDirectory" ), "includeBaseDirectory", parser, "true" ) );
728 }
729 else if ( checkFieldWithDuplicate( parser, "baseDirectory", null, parsed ) )
730 {
731 assembly.setBaseDirectory( interpolatedTrimmed( parser.nextText(), "baseDirectory" ) );
732 }
733 else if ( checkFieldWithDuplicate( parser, "includeSiteDirectory", null, parsed ) )
734 {
735 assembly.setIncludeSiteDirectory( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeSiteDirectory" ), "includeSiteDirectory", parser, "false" ) );
736 }
737 else if ( checkFieldWithDuplicate( parser, "containerDescriptorHandlers", null, parsed ) )
738 {
739 java.util.List<ContainerDescriptorHandlerConfig> containerDescriptorHandlers = new java.util.ArrayList<ContainerDescriptorHandlerConfig>();
740 while ( parser.nextTag() == XmlPullParser.START_TAG )
741 {
742 if ( "containerDescriptorHandler".equals( parser.getName() ) )
743 {
744 containerDescriptorHandlers.add( parseContainerDescriptorHandlerConfig( parser, strict ) );
745 }
746 else
747 {
748 checkUnknownElement( parser, strict );
749 }
750 }
751 assembly.setContainerDescriptorHandlers( containerDescriptorHandlers );
752 }
753 else if ( checkFieldWithDuplicate( parser, "moduleSets", null, parsed ) )
754 {
755 java.util.List<ModuleSet> moduleSets = new java.util.ArrayList<ModuleSet>();
756 while ( parser.nextTag() == XmlPullParser.START_TAG )
757 {
758 if ( "moduleSet".equals( parser.getName() ) )
759 {
760 moduleSets.add( parseModuleSet( parser, strict ) );
761 }
762 else
763 {
764 checkUnknownElement( parser, strict );
765 }
766 }
767 assembly.setModuleSets( moduleSets );
768 }
769 else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
770 {
771 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
772 while ( parser.nextTag() == XmlPullParser.START_TAG )
773 {
774 if ( "fileSet".equals( parser.getName() ) )
775 {
776 fileSets.add( parseFileSet( parser, strict ) );
777 }
778 else
779 {
780 checkUnknownElement( parser, strict );
781 }
782 }
783 assembly.setFileSets( fileSets );
784 }
785 else if ( checkFieldWithDuplicate( parser, "files", null, parsed ) )
786 {
787 java.util.List<FileItem> files = new java.util.ArrayList<FileItem>();
788 while ( parser.nextTag() == XmlPullParser.START_TAG )
789 {
790 if ( "file".equals( parser.getName() ) )
791 {
792 files.add( parseFileItem( parser, strict ) );
793 }
794 else
795 {
796 checkUnknownElement( parser, strict );
797 }
798 }
799 assembly.setFiles( files );
800 }
801 else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
802 {
803 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
804 while ( parser.nextTag() == XmlPullParser.START_TAG )
805 {
806 if ( "dependencySet".equals( parser.getName() ) )
807 {
808 dependencySets.add( parseDependencySet( parser, strict ) );
809 }
810 else
811 {
812 checkUnknownElement( parser, strict );
813 }
814 }
815 assembly.setDependencySets( dependencySets );
816 }
817 else if ( checkFieldWithDuplicate( parser, "componentDescriptors", null, parsed ) )
818 {
819 java.util.List<String> componentDescriptors = new java.util.ArrayList<String>();
820 while ( parser.nextTag() == XmlPullParser.START_TAG )
821 {
822 if ( "componentDescriptor".equals( parser.getName() ) )
823 {
824 componentDescriptors.add( interpolatedTrimmed( parser.nextText(), "componentDescriptors" ) );
825 }
826 else
827 {
828 checkUnknownElement( parser, strict );
829 }
830 }
831 assembly.setComponentDescriptors( componentDescriptors );
832 }
833 else
834 {
835 checkUnknownElement( parser, strict );
836 }
837 }
838 return assembly;
839 }
840
841
842
843
844
845
846
847
848
849
850
851 private ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser parser, boolean strict )
852 throws IOException, XmlPullParserException
853 {
854 String tagName = parser.getName();
855 ContainerDescriptorHandlerConfig containerDescriptorHandlerConfig = new ContainerDescriptorHandlerConfig();
856 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
857 {
858 String name = parser.getAttributeName( i );
859 String value = parser.getAttributeValue( i );
860
861 if ( name.indexOf( ':' ) >= 0 )
862 {
863
864 }
865 else
866 {
867 checkUnknownAttribute( parser, name, tagName, strict );
868 }
869 }
870 java.util.Set parsed = new java.util.HashSet();
871 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
872 {
873 if ( checkFieldWithDuplicate( parser, "handlerName", null, parsed ) )
874 {
875 containerDescriptorHandlerConfig.setHandlerName( interpolatedTrimmed( parser.nextText(), "handlerName" ) );
876 }
877 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
878 {
879 containerDescriptorHandlerConfig.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
880 }
881 else
882 {
883 checkUnknownElement( parser, strict );
884 }
885 }
886 return containerDescriptorHandlerConfig;
887 }
888
889
890
891
892
893
894
895
896
897
898
899 private DependencySet parseDependencySet( XmlPullParser parser, boolean strict )
900 throws IOException, XmlPullParserException
901 {
902 String tagName = parser.getName();
903 DependencySet dependencySet = new DependencySet();
904 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
905 {
906 String name = parser.getAttributeName( i );
907 String value = parser.getAttributeValue( i );
908
909 if ( name.indexOf( ':' ) >= 0 )
910 {
911
912 }
913 else
914 {
915 checkUnknownAttribute( parser, name, tagName, strict );
916 }
917 }
918 java.util.Set parsed = new java.util.HashSet();
919 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
920 {
921 if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
922 {
923 dependencySet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
924 }
925 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
926 {
927 java.util.List<String> includes = new java.util.ArrayList<String>();
928 while ( parser.nextTag() == XmlPullParser.START_TAG )
929 {
930 if ( "include".equals( parser.getName() ) )
931 {
932 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
933 }
934 else
935 {
936 checkUnknownElement( parser, strict );
937 }
938 }
939 dependencySet.setIncludes( includes );
940 }
941 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
942 {
943 java.util.List<String> excludes = new java.util.ArrayList<String>();
944 while ( parser.nextTag() == XmlPullParser.START_TAG )
945 {
946 if ( "exclude".equals( parser.getName() ) )
947 {
948 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
949 }
950 else
951 {
952 checkUnknownElement( parser, strict );
953 }
954 }
955 dependencySet.setExcludes( excludes );
956 }
957 else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
958 {
959 dependencySet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
960 }
961 else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
962 {
963 dependencySet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
964 }
965 else if ( checkFieldWithDuplicate( parser, "useStrictFiltering", null, parsed ) )
966 {
967 dependencySet.setUseStrictFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useStrictFiltering" ), "useStrictFiltering", parser, "false" ) );
968 }
969 else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
970 {
971 dependencySet.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
972 }
973 else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
974 {
975 dependencySet.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "false" ) );
976 }
977 else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
978 {
979 dependencySet.setUnpackOptions( parseUnpackOptions( parser, strict ) );
980 }
981 else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
982 {
983 dependencySet.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
984 }
985 else if ( checkFieldWithDuplicate( parser, "useProjectArtifact", null, parsed ) )
986 {
987 dependencySet.setUseProjectArtifact( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectArtifact" ), "useProjectArtifact", parser, "true" ) );
988 }
989 else if ( checkFieldWithDuplicate( parser, "useProjectAttachments", null, parsed ) )
990 {
991 dependencySet.setUseProjectAttachments( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectAttachments" ), "useProjectAttachments", parser, "false" ) );
992 }
993 else if ( checkFieldWithDuplicate( parser, "useTransitiveDependencies", null, parsed ) )
994 {
995 dependencySet.setUseTransitiveDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveDependencies" ), "useTransitiveDependencies", parser, "true" ) );
996 }
997 else if ( checkFieldWithDuplicate( parser, "useTransitiveFiltering", null, parsed ) )
998 {
999 dependencySet.setUseTransitiveFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveFiltering" ), "useTransitiveFiltering", parser, "false" ) );
1000 }
1001 else
1002 {
1003 checkUnknownElement( parser, strict );
1004 }
1005 }
1006 return dependencySet;
1007 }
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019 private FileItem parseFileItem( XmlPullParser parser, boolean strict )
1020 throws IOException, XmlPullParserException
1021 {
1022 String tagName = parser.getName();
1023 FileItem fileItem = new FileItem();
1024 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1025 {
1026 String name = parser.getAttributeName( i );
1027 String value = parser.getAttributeValue( i );
1028
1029 if ( name.indexOf( ':' ) >= 0 )
1030 {
1031
1032 }
1033 else
1034 {
1035 checkUnknownAttribute( parser, name, tagName, strict );
1036 }
1037 }
1038 java.util.Set parsed = new java.util.HashSet();
1039 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1040 {
1041 if ( checkFieldWithDuplicate( parser, "source", null, parsed ) )
1042 {
1043 fileItem.setSource( interpolatedTrimmed( parser.nextText(), "source" ) );
1044 }
1045 else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
1046 {
1047 java.util.List<String> sources = new java.util.ArrayList<String>();
1048 while ( parser.nextTag() == XmlPullParser.START_TAG )
1049 {
1050 if ( "source".equals( parser.getName() ) )
1051 {
1052 sources.add( interpolatedTrimmed( parser.nextText(), "sources" ) );
1053 }
1054 else
1055 {
1056 checkUnknownElement( parser, strict );
1057 }
1058 }
1059 fileItem.setSources( sources );
1060 }
1061 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1062 {
1063 fileItem.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1064 }
1065 else if ( checkFieldWithDuplicate( parser, "destName", null, parsed ) )
1066 {
1067 fileItem.setDestName( interpolatedTrimmed( parser.nextText(), "destName" ) );
1068 }
1069 else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1070 {
1071 fileItem.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1072 }
1073 else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1074 {
1075 fileItem.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1076 }
1077 else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1078 {
1079 fileItem.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1080 }
1081 else
1082 {
1083 checkUnknownElement( parser, strict );
1084 }
1085 }
1086 return fileItem;
1087 }
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099 private FileSet parseFileSet( XmlPullParser parser, boolean strict )
1100 throws IOException, XmlPullParserException
1101 {
1102 String tagName = parser.getName();
1103 FileSet fileSet = new FileSet();
1104 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1105 {
1106 String name = parser.getAttributeName( i );
1107 String value = parser.getAttributeValue( i );
1108
1109 if ( name.indexOf( ':' ) >= 0 )
1110 {
1111
1112 }
1113 else
1114 {
1115 checkUnknownAttribute( parser, name, tagName, strict );
1116 }
1117 }
1118 java.util.Set parsed = new java.util.HashSet();
1119 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1120 {
1121 if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1122 {
1123 fileSet.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1124 }
1125 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1126 {
1127 fileSet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1128 }
1129 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1130 {
1131 java.util.List<String> includes = new java.util.ArrayList<String>();
1132 while ( parser.nextTag() == XmlPullParser.START_TAG )
1133 {
1134 if ( "include".equals( parser.getName() ) )
1135 {
1136 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1137 }
1138 else
1139 {
1140 checkUnknownElement( parser, strict );
1141 }
1142 }
1143 fileSet.setIncludes( includes );
1144 }
1145 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1146 {
1147 java.util.List<String> excludes = new java.util.ArrayList<String>();
1148 while ( parser.nextTag() == XmlPullParser.START_TAG )
1149 {
1150 if ( "exclude".equals( parser.getName() ) )
1151 {
1152 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1153 }
1154 else
1155 {
1156 checkUnknownElement( parser, strict );
1157 }
1158 }
1159 fileSet.setExcludes( excludes );
1160 }
1161 else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1162 {
1163 fileSet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1164 }
1165 else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1166 {
1167 fileSet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1168 }
1169 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1170 {
1171 fileSet.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
1172 }
1173 else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1174 {
1175 fileSet.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1176 }
1177 else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1178 {
1179 fileSet.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1180 }
1181 else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1182 {
1183 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1184 while ( parser.nextTag() == XmlPullParser.START_TAG )
1185 {
1186 if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1187 {
1188 nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1189 }
1190 else
1191 {
1192 checkUnknownElement( parser, strict );
1193 }
1194 }
1195 fileSet.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1196 }
1197 else
1198 {
1199 checkUnknownElement( parser, strict );
1200 }
1201 }
1202 return fileSet;
1203 }
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215 private ModuleBinaries parseModuleBinaries( XmlPullParser parser, boolean strict )
1216 throws IOException, XmlPullParserException
1217 {
1218 String tagName = parser.getName();
1219 ModuleBinaries moduleBinaries = new ModuleBinaries();
1220 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1221 {
1222 String name = parser.getAttributeName( i );
1223 String value = parser.getAttributeValue( i );
1224
1225 if ( name.indexOf( ':' ) >= 0 )
1226 {
1227
1228 }
1229 else
1230 {
1231 checkUnknownAttribute( parser, name, tagName, strict );
1232 }
1233 }
1234 java.util.Set parsed = new java.util.HashSet();
1235 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1236 {
1237 if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1238 {
1239 moduleBinaries.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1240 }
1241 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1242 {
1243 java.util.List<String> includes = new java.util.ArrayList<String>();
1244 while ( parser.nextTag() == XmlPullParser.START_TAG )
1245 {
1246 if ( "include".equals( parser.getName() ) )
1247 {
1248 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1249 }
1250 else
1251 {
1252 checkUnknownElement( parser, strict );
1253 }
1254 }
1255 moduleBinaries.setIncludes( includes );
1256 }
1257 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1258 {
1259 java.util.List<String> excludes = new java.util.ArrayList<String>();
1260 while ( parser.nextTag() == XmlPullParser.START_TAG )
1261 {
1262 if ( "exclude".equals( parser.getName() ) )
1263 {
1264 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1265 }
1266 else
1267 {
1268 checkUnknownElement( parser, strict );
1269 }
1270 }
1271 moduleBinaries.setExcludes( excludes );
1272 }
1273 else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1274 {
1275 moduleBinaries.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1276 }
1277 else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1278 {
1279 moduleBinaries.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1280 }
1281 else if ( checkFieldWithDuplicate( parser, "attachmentClassifier", null, parsed ) )
1282 {
1283 moduleBinaries.setAttachmentClassifier( interpolatedTrimmed( parser.nextText(), "attachmentClassifier" ) );
1284 }
1285 else if ( checkFieldWithDuplicate( parser, "includeDependencies", null, parsed ) )
1286 {
1287 moduleBinaries.setIncludeDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeDependencies" ), "includeDependencies", parser, "true" ) );
1288 }
1289 else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
1290 {
1291 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
1292 while ( parser.nextTag() == XmlPullParser.START_TAG )
1293 {
1294 if ( "dependencySet".equals( parser.getName() ) )
1295 {
1296 dependencySets.add( parseDependencySet( parser, strict ) );
1297 }
1298 else
1299 {
1300 checkUnknownElement( parser, strict );
1301 }
1302 }
1303 moduleBinaries.setDependencySets( dependencySets );
1304 }
1305 else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
1306 {
1307 moduleBinaries.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "true" ) );
1308 }
1309 else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
1310 {
1311 moduleBinaries.setUnpackOptions( parseUnpackOptions( parser, strict ) );
1312 }
1313 else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
1314 {
1315 moduleBinaries.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
1316 }
1317 else
1318 {
1319 checkUnknownElement( parser, strict );
1320 }
1321 }
1322 return moduleBinaries;
1323 }
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335 private ModuleSet parseModuleSet( XmlPullParser parser, boolean strict )
1336 throws IOException, XmlPullParserException
1337 {
1338 String tagName = parser.getName();
1339 ModuleSet moduleSet = new ModuleSet();
1340 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1341 {
1342 String name = parser.getAttributeName( i );
1343 String value = parser.getAttributeValue( i );
1344
1345 if ( name.indexOf( ':' ) >= 0 )
1346 {
1347
1348 }
1349 else
1350 {
1351 checkUnknownAttribute( parser, name, tagName, strict );
1352 }
1353 }
1354 java.util.Set parsed = new java.util.HashSet();
1355 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1356 {
1357 if ( checkFieldWithDuplicate( parser, "useAllReactorProjects", null, parsed ) )
1358 {
1359 moduleSet.setUseAllReactorProjects( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useAllReactorProjects" ), "useAllReactorProjects", parser, "false" ) );
1360 }
1361 else if ( checkFieldWithDuplicate( parser, "includeSubModules", null, parsed ) )
1362 {
1363 moduleSet.setIncludeSubModules( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeSubModules" ), "includeSubModules", parser, "true" ) );
1364 }
1365 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1366 {
1367 java.util.List<String> includes = new java.util.ArrayList<String>();
1368 while ( parser.nextTag() == XmlPullParser.START_TAG )
1369 {
1370 if ( "include".equals( parser.getName() ) )
1371 {
1372 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1373 }
1374 else
1375 {
1376 checkUnknownElement( parser, strict );
1377 }
1378 }
1379 moduleSet.setIncludes( includes );
1380 }
1381 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1382 {
1383 java.util.List<String> excludes = new java.util.ArrayList<String>();
1384 while ( parser.nextTag() == XmlPullParser.START_TAG )
1385 {
1386 if ( "exclude".equals( parser.getName() ) )
1387 {
1388 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1389 }
1390 else
1391 {
1392 checkUnknownElement( parser, strict );
1393 }
1394 }
1395 moduleSet.setExcludes( excludes );
1396 }
1397 else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
1398 {
1399 moduleSet.setSources( parseModuleSources( parser, strict ) );
1400 }
1401 else if ( checkFieldWithDuplicate( parser, "binaries", null, parsed ) )
1402 {
1403 moduleSet.setBinaries( parseModuleBinaries( parser, strict ) );
1404 }
1405 else
1406 {
1407 checkUnknownElement( parser, strict );
1408 }
1409 }
1410 return moduleSet;
1411 }
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423 private ModuleSources parseModuleSources( XmlPullParser parser, boolean strict )
1424 throws IOException, XmlPullParserException
1425 {
1426 String tagName = parser.getName();
1427 ModuleSources moduleSources = new ModuleSources();
1428 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1429 {
1430 String name = parser.getAttributeName( i );
1431 String value = parser.getAttributeValue( i );
1432
1433 if ( name.indexOf( ':' ) >= 0 )
1434 {
1435
1436 }
1437 else
1438 {
1439 checkUnknownAttribute( parser, name, tagName, strict );
1440 }
1441 }
1442 java.util.Set parsed = new java.util.HashSet();
1443 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1444 {
1445 if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1446 {
1447 moduleSources.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1448 }
1449 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1450 {
1451 moduleSources.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1452 }
1453 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1454 {
1455 java.util.List<String> includes = new java.util.ArrayList<String>();
1456 while ( parser.nextTag() == XmlPullParser.START_TAG )
1457 {
1458 if ( "include".equals( parser.getName() ) )
1459 {
1460 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1461 }
1462 else
1463 {
1464 checkUnknownElement( parser, strict );
1465 }
1466 }
1467 moduleSources.setIncludes( includes );
1468 }
1469 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1470 {
1471 java.util.List<String> excludes = new java.util.ArrayList<String>();
1472 while ( parser.nextTag() == XmlPullParser.START_TAG )
1473 {
1474 if ( "exclude".equals( parser.getName() ) )
1475 {
1476 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1477 }
1478 else
1479 {
1480 checkUnknownElement( parser, strict );
1481 }
1482 }
1483 moduleSources.setExcludes( excludes );
1484 }
1485 else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1486 {
1487 moduleSources.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1488 }
1489 else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1490 {
1491 moduleSources.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1492 }
1493 else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
1494 {
1495 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
1496 while ( parser.nextTag() == XmlPullParser.START_TAG )
1497 {
1498 if ( "fileSet".equals( parser.getName() ) )
1499 {
1500 fileSets.add( parseFileSet( parser, strict ) );
1501 }
1502 else
1503 {
1504 checkUnknownElement( parser, strict );
1505 }
1506 }
1507 moduleSources.setFileSets( fileSets );
1508 }
1509 else if ( checkFieldWithDuplicate( parser, "includeModuleDirectory", null, parsed ) )
1510 {
1511 moduleSources.setIncludeModuleDirectory( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeModuleDirectory" ), "includeModuleDirectory", parser, "true" ) );
1512 }
1513 else if ( checkFieldWithDuplicate( parser, "excludeSubModuleDirectories", null, parsed ) )
1514 {
1515 moduleSources.setExcludeSubModuleDirectories( getBooleanValue( interpolatedTrimmed( parser.nextText(), "excludeSubModuleDirectories" ), "excludeSubModuleDirectories", parser, "true" ) );
1516 }
1517 else if ( checkFieldWithDuplicate( parser, "outputDirectoryMapping", null, parsed ) )
1518 {
1519 moduleSources.setOutputDirectoryMapping( interpolatedTrimmed( parser.nextText(), "outputDirectoryMapping" ) );
1520 }
1521 else
1522 {
1523 checkUnknownElement( parser, strict );
1524 }
1525 }
1526 return moduleSources;
1527 }
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539 private UnpackOptions parseUnpackOptions( XmlPullParser parser, boolean strict )
1540 throws IOException, XmlPullParserException
1541 {
1542 String tagName = parser.getName();
1543 UnpackOptions unpackOptions = new UnpackOptions();
1544 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1545 {
1546 String name = parser.getAttributeName( i );
1547 String value = parser.getAttributeValue( i );
1548
1549 if ( name.indexOf( ':' ) >= 0 )
1550 {
1551
1552 }
1553 else
1554 {
1555 checkUnknownAttribute( parser, name, tagName, strict );
1556 }
1557 }
1558 java.util.Set parsed = new java.util.HashSet();
1559 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1560 {
1561 if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1562 {
1563 java.util.List<String> includes = new java.util.ArrayList<String>();
1564 while ( parser.nextTag() == XmlPullParser.START_TAG )
1565 {
1566 if ( "include".equals( parser.getName() ) )
1567 {
1568 includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1569 }
1570 else
1571 {
1572 checkUnknownElement( parser, strict );
1573 }
1574 }
1575 unpackOptions.setIncludes( includes );
1576 }
1577 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1578 {
1579 java.util.List<String> excludes = new java.util.ArrayList<String>();
1580 while ( parser.nextTag() == XmlPullParser.START_TAG )
1581 {
1582 if ( "exclude".equals( parser.getName() ) )
1583 {
1584 excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1585 }
1586 else
1587 {
1588 checkUnknownElement( parser, strict );
1589 }
1590 }
1591 unpackOptions.setExcludes( excludes );
1592 }
1593 else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1594 {
1595 unpackOptions.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1596 }
1597 else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1598 {
1599 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1600 while ( parser.nextTag() == XmlPullParser.START_TAG )
1601 {
1602 if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1603 {
1604 nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1605 }
1606 else
1607 {
1608 checkUnknownElement( parser, strict );
1609 }
1610 }
1611 unpackOptions.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1612 }
1613 else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1614 {
1615 unpackOptions.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1616 }
1617 else if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1618 {
1619 unpackOptions.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1620 }
1621 else if ( checkFieldWithDuplicate( parser, "encoding", null, parsed ) )
1622 {
1623 unpackOptions.setEncoding( interpolatedTrimmed( parser.nextText(), "encoding" ) );
1624 }
1625 else
1626 {
1627 checkUnknownElement( parser, strict );
1628 }
1629 }
1630 return unpackOptions;
1631 }
1632
1633
1634
1635
1636
1637
1638 public void setAddDefaultEntities( boolean addDefaultEntities )
1639 {
1640 this.addDefaultEntities = addDefaultEntities;
1641 }
1642
1643 public static interface ContentTransformer
1644 {
1645
1646
1647
1648
1649
1650
1651
1652 String transform( String source, String fieldName );
1653 }
1654
1655 }