001// =================== DO NOT EDIT THIS FILE ====================
002// Generated by Modello 2.3.0,
003// any modifications will be overwritten.
004// ==============================================================
005
006package org.codehaus.modello.test.features.io.xpp3;
007
008  //---------------------------------/
009 //- Imported classes and packages -/
010//---------------------------------/
011
012import java.io.IOException;
013import java.io.InputStream;
014import java.io.Reader;
015import java.text.DateFormat;
016import org.codehaus.modello.test.features.Action;
017import org.codehaus.modello.test.features.AnnotationTest;
018import org.codehaus.modello.test.features.ArrayFeatures;
019import org.codehaus.modello.test.features.AssociationFeatures;
020import org.codehaus.modello.test.features.BaseClass;
021import org.codehaus.modello.test.features.BidiInList;
022import org.codehaus.modello.test.features.BidiInSet;
023import org.codehaus.modello.test.features.Bidirectional;
024import org.codehaus.modello.test.features.ContentTest;
025import org.codehaus.modello.test.features.DueTo;
026import org.codehaus.modello.test.features.Features;
027import org.codehaus.modello.test.features.File;
028import org.codehaus.modello.test.features.InterfacesFeature;
029import org.codehaus.modello.test.features.JavaFeatures;
030import org.codehaus.modello.test.features.NodeItem;
031import org.codehaus.modello.test.features.Reference;
032import org.codehaus.modello.test.features.SimpleInterface;
033import org.codehaus.modello.test.features.SimpleTypes;
034import org.codehaus.modello.test.features.SubClassLevel1;
035import org.codehaus.modello.test.features.SubClassLevel2;
036import org.codehaus.modello.test.features.SubClassLevel3;
037import org.codehaus.modello.test.features.SubInterface;
038import org.codehaus.modello.test.features.SuperThing;
039import org.codehaus.modello.test.features.Thing;
040import org.codehaus.modello.test.features.Thingy;
041import org.codehaus.modello.test.features.XdocFeatures;
042import org.codehaus.modello.test.features.XmlAttributes;
043import org.codehaus.modello.test.features.XmlContent;
044import org.codehaus.modello.test.features.XmlContentLong;
045import org.codehaus.modello.test.features.XmlContentLongWithAttributes;
046import org.codehaus.modello.test.features.XmlFeatures;
047import org.codehaus.modello.test.features.XmlFieldsOrder;
048import org.codehaus.modello.test.features.XmlFieldsOrderParent;
049import org.codehaus.modello.test.features.XmlFieldsOrderParent2;
050import org.codehaus.modello.test.features.XmlTransientFields;
051import org.codehaus.modello.test.features.XsdFeatures;
052import org.codehaus.modello.test.features.other.PackageNameFeature;
053import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
054import org.codehaus.plexus.util.xml.XmlStreamReader;
055import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
056import org.codehaus.plexus.util.xml.pull.MXParser;
057import org.codehaus.plexus.util.xml.pull.XmlPullParser;
058import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
059
060/**
061 * Class ModelloFeaturesTestXpp3Reader.
062 * 
063 * @version $Revision$ $Date$
064 */
065@SuppressWarnings( "all" )
066public class ModelloFeaturesTestXpp3Reader
067{
068
069      //--------------------------/
070     //- Class/Member Variables -/
071    //--------------------------/
072
073    /**
074     * If set the parser will be loaded with all single characters
075     * from the XHTML specification.
076     * The entities used:
077     * <ul>
078     * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
079     * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
080     * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
081     * </ul>
082     */
083    private boolean addDefaultEntities = true;
084
085    /**
086     * Field contentTransformer.
087     */
088    public final ContentTransformer contentTransformer;
089
090
091      //----------------/
092     //- Constructors -/
093    //----------------/
094
095    public ModelloFeaturesTestXpp3Reader()
096    {
097        this( new ContentTransformer()
098        {
099            public String transform( String source, String fieldName )
100            {
101                return source;
102            }
103        } );
104    } //-- org.codehaus.modello.test.features.io.xpp3.ModelloFeaturesTestXpp3Reader()
105
106    public ModelloFeaturesTestXpp3Reader(ContentTransformer contentTransformer)
107    {
108        this.contentTransformer = contentTransformer;
109    } //-- org.codehaus.modello.test.features.io.xpp3.ModelloFeaturesTestXpp3Reader(ContentTransformer)
110
111
112      //-----------/
113     //- Methods -/
114    //-----------/
115
116    /**
117     * Method checkFieldWithDuplicate.
118     * 
119     * @param parser a parser object.
120     * @param parsed a parsed object.
121     * @param alias a alias object.
122     * @param tagName a tagName object.
123     * @throws XmlPullParserException XmlPullParserException if
124     * any.
125     * @return boolean
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    } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set )
140
141    /**
142     * Method checkUnknownAttribute.
143     * 
144     * @param parser a parser object.
145     * @param strict a strict object.
146     * @param tagName a tagName object.
147     * @param attribute a attribute object.
148     * @throws XmlPullParserException XmlPullParserException if
149     * any.
150     * @throws IOException IOException if any.
151     */
152    private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
153        throws XmlPullParserException, IOException
154    {
155        // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too
156        if ( strict )
157        {
158            throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
159        }
160    } //-- void checkUnknownAttribute( XmlPullParser, String, String, boolean )
161
162    /**
163     * Method checkUnknownElement.
164     * 
165     * @param parser a parser object.
166     * @param strict a strict object.
167     * @throws XmlPullParserException XmlPullParserException if
168     * any.
169     * @throws IOException IOException if any.
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    } //-- void checkUnknownElement( XmlPullParser, boolean )
192
193    /**
194     * Returns the state of the "add default entities" flag.
195     * 
196     * @return boolean
197     */
198    public boolean getAddDefaultEntities()
199    {
200        return addDefaultEntities;
201    } //-- boolean getAddDefaultEntities()
202
203    /**
204     * Method getBooleanValue.
205     * 
206     * @param s a s object.
207     * @param parser a parser object.
208     * @param attribute a attribute object.
209     * @throws XmlPullParserException XmlPullParserException if
210     * any.
211     * @return boolean
212     */
213    private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
214        throws XmlPullParserException
215    {
216        return getBooleanValue( s, attribute, parser, null );
217    } //-- boolean getBooleanValue( String, String, XmlPullParser )
218
219    /**
220     * Method getBooleanValue.
221     * 
222     * @param s a s object.
223     * @param defaultValue a defaultValue object.
224     * @param parser a parser object.
225     * @param attribute a attribute object.
226     * @throws XmlPullParserException XmlPullParserException if
227     * any.
228     * @return boolean
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    } //-- boolean getBooleanValue( String, String, XmlPullParser, String )
243
244    /**
245     * Method getByteValue.
246     * 
247     * @param s a s object.
248     * @param strict a strict object.
249     * @param parser a parser object.
250     * @param attribute a attribute object.
251     * @throws XmlPullParserException XmlPullParserException if
252     * any.
253     * @return byte
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    } //-- byte getByteValue( String, String, XmlPullParser, boolean )
274
275    /**
276     * Method getCharacterValue.
277     * 
278     * @param s a s object.
279     * @param parser a parser object.
280     * @param attribute a attribute object.
281     * @throws XmlPullParserException XmlPullParserException if
282     * any.
283     * @return char
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    } //-- char getCharacterValue( String, String, XmlPullParser )
294
295    /**
296     * Method getDateValue.
297     * 
298     * @param s a s object.
299     * @param parser a parser object.
300     * @param attribute a attribute object.
301     * @throws XmlPullParserException XmlPullParserException if
302     * any.
303     * @return Date
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    } //-- java.util.Date getDateValue( String, String, XmlPullParser )
310
311    /**
312     * Method getDateValue.
313     * 
314     * @param s a s object.
315     * @param parser a parser object.
316     * @param dateFormat a dateFormat object.
317     * @param attribute a attribute object.
318     * @throws XmlPullParserException XmlPullParserException if
319     * any.
320     * @return Date
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    } //-- java.util.Date getDateValue( String, String, String, XmlPullParser )
358
359    /**
360     * Method getDoubleValue.
361     * 
362     * @param s a s object.
363     * @param strict a strict object.
364     * @param parser a parser object.
365     * @param attribute a attribute object.
366     * @throws XmlPullParserException XmlPullParserException if
367     * any.
368     * @return double
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    } //-- double getDoubleValue( String, String, XmlPullParser, boolean )
389
390    /**
391     * Method getFloatValue.
392     * 
393     * @param s a s object.
394     * @param strict a strict object.
395     * @param parser a parser object.
396     * @param attribute a attribute object.
397     * @throws XmlPullParserException XmlPullParserException if
398     * any.
399     * @return float
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    } //-- float getFloatValue( String, String, XmlPullParser, boolean )
420
421    /**
422     * Method getIntegerValue.
423     * 
424     * @param s a s object.
425     * @param strict a strict object.
426     * @param parser a parser object.
427     * @param attribute a attribute object.
428     * @throws XmlPullParserException XmlPullParserException if
429     * any.
430     * @return int
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    } //-- int getIntegerValue( String, String, XmlPullParser, boolean )
451
452    /**
453     * Method getLongValue.
454     * 
455     * @param s a s object.
456     * @param strict a strict object.
457     * @param parser a parser object.
458     * @param attribute a attribute object.
459     * @throws XmlPullParserException XmlPullParserException if
460     * any.
461     * @return long
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    } //-- long getLongValue( String, String, XmlPullParser, boolean )
482
483    /**
484     * Method getRequiredAttributeValue.
485     * 
486     * @param s a s object.
487     * @param strict a strict object.
488     * @param parser a parser object.
489     * @param attribute a attribute object.
490     * @throws XmlPullParserException XmlPullParserException if
491     * any.
492     * @return String
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    } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean )
506
507    /**
508     * Method getShortValue.
509     * 
510     * @param s a s object.
511     * @param strict a strict object.
512     * @param parser a parser object.
513     * @param attribute a attribute object.
514     * @throws XmlPullParserException XmlPullParserException if
515     * any.
516     * @return short
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    } //-- short getShortValue( String, String, XmlPullParser, boolean )
537
538    /**
539     * Method getTrimmedValue.
540     * 
541     * @param s a s object.
542     * @return String
543     */
544    private String getTrimmedValue( String s )
545    {
546        if ( s != null )
547        {
548            s = s.trim();
549        }
550        return s;
551    } //-- String getTrimmedValue( String )
552
553    /**
554     * Method interpolatedTrimmed.
555     * 
556     * @param value a value object.
557     * @param context a context object.
558     * @return String
559     */
560    private String interpolatedTrimmed( String value, String context )
561    {
562        return getTrimmedValue( contentTransformer.transform( value, context ) );
563    } //-- String interpolatedTrimmed( String, String )
564
565    /**
566     * Method nextTag.
567     * 
568     * @param parser a parser object.
569     * @throws IOException IOException if any.
570     * @throws XmlPullParserException XmlPullParserException if
571     * any.
572     * @return int
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    } //-- int nextTag( XmlPullParser )
588
589    /**
590     * Method read.
591     * 
592     * @param parser a parser object.
593     * @param strict a strict object.
594     * @throws IOException IOException if any.
595     * @throws XmlPullParserException XmlPullParserException if
596     * any.
597     * @return Features
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                    // fallback, already expected a XmlPullParserException due to invalid XML
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    } //-- Features read( XmlPullParser, boolean )
630
631    /**
632     * @see XmlStreamReader
633     * 
634     * @param reader a reader object.
635     * @param strict a strict object.
636     * @throws IOException IOException if any.
637     * @throws XmlPullParserException XmlPullParserException if
638     * any.
639     * @return Features
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    } //-- Features read( Reader, boolean )
651
652    /**
653     * @see XmlStreamReader
654     * 
655     * @param reader a reader object.
656     * @throws IOException IOException if any.
657     * @throws XmlPullParserException XmlPullParserException if
658     * any.
659     * @return Features
660     */
661    public Features read( Reader reader )
662        throws IOException, XmlPullParserException
663    {
664        return read( reader, true );
665    } //-- Features read( Reader )
666
667    /**
668     * Method read.
669     * 
670     * @param in a in object.
671     * @param strict a strict object.
672     * @throws IOException IOException if any.
673     * @throws XmlPullParserException XmlPullParserException if
674     * any.
675     * @return Features
676     */
677    public Features read( InputStream in, boolean strict )
678        throws IOException, XmlPullParserException
679    {
680        return read( new XmlStreamReader( in ), strict );
681    } //-- Features read( InputStream, boolean )
682
683    /**
684     * Method read.
685     * 
686     * @param in a in object.
687     * @throws IOException IOException if any.
688     * @throws XmlPullParserException XmlPullParserException if
689     * any.
690     * @return Features
691     */
692    public Features read( InputStream in )
693        throws IOException, XmlPullParserException
694    {
695        return read( new XmlStreamReader( in ) );
696    } //-- Features read( InputStream )
697
698    /**
699     * Method parseAction.
700     * 
701     * @param parser a parser object.
702     * @param strict a strict object.
703     * @throws IOException IOException if any.
704     * @throws XmlPullParserException XmlPullParserException if
705     * any.
706     * @return Action
707     */
708    private Action parseAction( XmlPullParser parser, boolean strict )
709        throws IOException, XmlPullParserException
710    {
711        String tagName = parser.getName();
712        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- Action parseAction( XmlPullParser, boolean )
734
735    /**
736     * Method parseAnnotationTest.
737     * 
738     * @param parser a parser object.
739     * @param strict a strict object.
740     * @throws IOException IOException if any.
741     * @throws XmlPullParserException XmlPullParserException if
742     * any.
743     * @return AnnotationTest
744     */
745    private AnnotationTest parseAnnotationTest( XmlPullParser parser, boolean strict )
746        throws IOException, XmlPullParserException
747    {
748        String tagName = parser.getName();
749        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- AnnotationTest parseAnnotationTest( XmlPullParser, boolean )
778
779    /**
780     * Method parseArrayFeatures.
781     * 
782     * @param parser a parser object.
783     * @param strict a strict object.
784     * @throws IOException IOException if any.
785     * @throws XmlPullParserException XmlPullParserException if
786     * any.
787     * @return ArrayFeatures
788     */
789    private ArrayFeatures parseArrayFeatures( XmlPullParser parser, boolean strict )
790        throws IOException, XmlPullParserException
791    {
792        String tagName = parser.getName();
793        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- ArrayFeatures parseArrayFeatures( XmlPullParser, boolean )
815
816    /**
817     * Method parseAssociationFeatures.
818     * 
819     * @param parser a parser object.
820     * @param strict a strict object.
821     * @throws IOException IOException if any.
822     * @throws XmlPullParserException XmlPullParserException if
823     * any.
824     * @return AssociationFeatures
825     */
826    private AssociationFeatures parseAssociationFeatures( XmlPullParser parser, boolean strict )
827        throws IOException, XmlPullParserException
828    {
829        String tagName = parser.getName();
830        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- AssociationFeatures parseAssociationFeatures( XmlPullParser, boolean )
964
965    /**
966     * Method parseBaseClass.
967     * 
968     * @param parser a parser object.
969     * @param strict a strict object.
970     * @throws IOException IOException if any.
971     * @throws XmlPullParserException XmlPullParserException if
972     * any.
973     * @return BaseClass
974     */
975    private BaseClass parseBaseClass( XmlPullParser parser, boolean strict )
976        throws IOException, XmlPullParserException
977    {
978        String tagName = parser.getName();
979        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- BaseClass parseBaseClass( XmlPullParser, boolean )
1012
1013    /**
1014     * Method parseBidiInList.
1015     * 
1016     * @param parser a parser object.
1017     * @param strict a strict object.
1018     * @throws IOException IOException if any.
1019     * @throws XmlPullParserException XmlPullParserException if
1020     * any.
1021     * @return BidiInList
1022     */
1023    private BidiInList parseBidiInList( XmlPullParser parser, boolean strict )
1024        throws IOException, XmlPullParserException
1025    {
1026        String tagName = parser.getName();
1027        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- BidiInList parseBidiInList( XmlPullParser, boolean )
1056
1057    /**
1058     * Method parseBidiInSet.
1059     * 
1060     * @param parser a parser object.
1061     * @param strict a strict object.
1062     * @throws IOException IOException if any.
1063     * @throws XmlPullParserException XmlPullParserException if
1064     * any.
1065     * @return BidiInSet
1066     */
1067    private BidiInSet parseBidiInSet( XmlPullParser parser, boolean strict )
1068        throws IOException, XmlPullParserException
1069    {
1070        String tagName = parser.getName();
1071        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- BidiInSet parseBidiInSet( XmlPullParser, boolean )
1100
1101    /**
1102     * Method parseBidirectional.
1103     * 
1104     * @param parser a parser object.
1105     * @param strict a strict object.
1106     * @throws IOException IOException if any.
1107     * @throws XmlPullParserException XmlPullParserException if
1108     * any.
1109     * @return Bidirectional
1110     */
1111    private Bidirectional parseBidirectional( XmlPullParser parser, boolean strict )
1112        throws IOException, XmlPullParserException
1113    {
1114        String tagName = parser.getName();
1115        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- Bidirectional parseBidirectional( XmlPullParser, boolean )
1144
1145    /**
1146     * Method parseContentTest.
1147     * 
1148     * @param parser a parser object.
1149     * @param strict a strict object.
1150     * @throws IOException IOException if any.
1151     * @throws XmlPullParserException XmlPullParserException if
1152     * any.
1153     * @return ContentTest
1154     */
1155    private ContentTest parseContentTest( XmlPullParser parser, boolean strict )
1156        throws IOException, XmlPullParserException
1157    {
1158        String tagName = parser.getName();
1159        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- ContentTest parseContentTest( XmlPullParser, boolean )
1185
1186    /**
1187     * Method parseDueTo.
1188     * 
1189     * @param parser a parser object.
1190     * @param strict a strict object.
1191     * @throws IOException IOException if any.
1192     * @throws XmlPullParserException XmlPullParserException if
1193     * any.
1194     * @return DueTo
1195     */
1196    private DueTo parseDueTo( XmlPullParser parser, boolean strict )
1197        throws IOException, XmlPullParserException
1198    {
1199        String tagName = parser.getName();
1200        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- DueTo parseDueTo( XmlPullParser, boolean )
1230
1231    /**
1232     * Method parseFeatures.
1233     * 
1234     * @param parser a parser object.
1235     * @param strict a strict object.
1236     * @throws IOException IOException if any.
1237     * @throws XmlPullParserException XmlPullParserException if
1238     * any.
1239     * @return Features
1240     */
1241    private Features parseFeatures( XmlPullParser parser, boolean strict )
1242        throws IOException, XmlPullParserException
1243    {
1244        String tagName = parser.getName();
1245        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1254            }
1255            else if ( "xmlns".equals( name ) )
1256            {
1257                // ignore xmlns attribute in root class, which is a reserved attribute name
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    } //-- Features parseFeatures( XmlPullParser, boolean )
1342
1343    /**
1344     * Method parseFile.
1345     * 
1346     * @param parser a parser object.
1347     * @param strict a strict object.
1348     * @throws IOException IOException if any.
1349     * @throws XmlPullParserException XmlPullParserException if
1350     * any.
1351     * @return File
1352     */
1353    private File parseFile( XmlPullParser parser, boolean strict )
1354        throws IOException, XmlPullParserException
1355    {
1356        String tagName = parser.getName();
1357        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- File parseFile( XmlPullParser, boolean )
1386
1387    /**
1388     * Method parseInterfacesFeature.
1389     * 
1390     * @param parser a parser object.
1391     * @param strict a strict object.
1392     * @throws IOException IOException if any.
1393     * @throws XmlPullParserException XmlPullParserException if
1394     * any.
1395     * @return InterfacesFeature
1396     */
1397    private InterfacesFeature parseInterfacesFeature( XmlPullParser parser, boolean strict )
1398        throws IOException, XmlPullParserException
1399    {
1400        String tagName = parser.getName();
1401        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- InterfacesFeature parseInterfacesFeature( XmlPullParser, boolean )
1430
1431    /**
1432     * Method parseJavaFeatures.
1433     * 
1434     * @param parser a parser object.
1435     * @param strict a strict object.
1436     * @throws IOException IOException if any.
1437     * @throws XmlPullParserException XmlPullParserException if
1438     * any.
1439     * @return JavaFeatures
1440     */
1441    private JavaFeatures parseJavaFeatures( XmlPullParser parser, boolean strict )
1442        throws IOException, XmlPullParserException
1443    {
1444        String tagName = parser.getName();
1445        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- JavaFeatures parseJavaFeatures( XmlPullParser, boolean )
1498
1499    /**
1500     * Method parseNodeItem.
1501     * 
1502     * @param parser a parser object.
1503     * @param strict a strict object.
1504     * @throws IOException IOException if any.
1505     * @throws XmlPullParserException XmlPullParserException if
1506     * any.
1507     * @return NodeItem
1508     */
1509    private NodeItem parseNodeItem( XmlPullParser parser, boolean strict )
1510        throws IOException, XmlPullParserException
1511    {
1512        String tagName = parser.getName();
1513        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- NodeItem parseNodeItem( XmlPullParser, boolean )
1546
1547    /**
1548     * Method parsePackageNameFeature.
1549     * 
1550     * @param parser a parser object.
1551     * @param strict a strict object.
1552     * @throws IOException IOException if any.
1553     * @throws XmlPullParserException XmlPullParserException if
1554     * any.
1555     * @return PackageNameFeature
1556     */
1557    private PackageNameFeature parsePackageNameFeature( XmlPullParser parser, boolean strict )
1558        throws IOException, XmlPullParserException
1559    {
1560        String tagName = parser.getName();
1561        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- PackageNameFeature parsePackageNameFeature( XmlPullParser, boolean )
1590
1591    /**
1592     * Method parseReference.
1593     * 
1594     * @param parser a parser object.
1595     * @param strict a strict object.
1596     * @throws IOException IOException if any.
1597     * @throws XmlPullParserException XmlPullParserException if
1598     * any.
1599     * @return Reference
1600     */
1601    private Reference parseReference( XmlPullParser parser, boolean strict )
1602        throws IOException, XmlPullParserException
1603    {
1604        String tagName = parser.getName();
1605        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- Reference parseReference( XmlPullParser, boolean )
1634
1635    /**
1636     * Method parseSimpleTypes.
1637     * 
1638     * @param parser a parser object.
1639     * @param strict a strict object.
1640     * @throws IOException IOException if any.
1641     * @throws XmlPullParserException XmlPullParserException if
1642     * any.
1643     * @return SimpleTypes
1644     */
1645    private SimpleTypes parseSimpleTypes( XmlPullParser parser, boolean strict )
1646        throws IOException, XmlPullParserException
1647    {
1648        String tagName = parser.getName();
1649        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- SimpleTypes parseSimpleTypes( XmlPullParser, boolean )
1764
1765    /**
1766     * Method parseSubClassLevel1.
1767     * 
1768     * @param parser a parser object.
1769     * @param strict a strict object.
1770     * @throws IOException IOException if any.
1771     * @throws XmlPullParserException XmlPullParserException if
1772     * any.
1773     * @return SubClassLevel1
1774     */
1775    private SubClassLevel1 parseSubClassLevel1( XmlPullParser parser, boolean strict )
1776        throws IOException, XmlPullParserException
1777    {
1778        String tagName = parser.getName();
1779        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- SubClassLevel1 parseSubClassLevel1( XmlPullParser, boolean )
1820
1821    /**
1822     * Method parseSubClassLevel2.
1823     * 
1824     * @param parser a parser object.
1825     * @param strict a strict object.
1826     * @throws IOException IOException if any.
1827     * @throws XmlPullParserException XmlPullParserException if
1828     * any.
1829     * @return SubClassLevel2
1830     */
1831    private SubClassLevel2 parseSubClassLevel2( XmlPullParser parser, boolean strict )
1832        throws IOException, XmlPullParserException
1833    {
1834        String tagName = parser.getName();
1835        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- SubClassLevel2 parseSubClassLevel2( XmlPullParser, boolean )
1884
1885    /**
1886     * Method parseSubClassLevel3.
1887     * 
1888     * @param parser a parser object.
1889     * @param strict a strict object.
1890     * @throws IOException IOException if any.
1891     * @throws XmlPullParserException XmlPullParserException if
1892     * any.
1893     * @return SubClassLevel3
1894     */
1895    private SubClassLevel3 parseSubClassLevel3( XmlPullParser parser, boolean strict )
1896        throws IOException, XmlPullParserException
1897    {
1898        String tagName = parser.getName();
1899        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- SubClassLevel3 parseSubClassLevel3( XmlPullParser, boolean )
1956
1957    /**
1958     * Method parseSuperThing.
1959     * 
1960     * @param parser a parser object.
1961     * @param strict a strict object.
1962     * @throws IOException IOException if any.
1963     * @throws XmlPullParserException XmlPullParserException if
1964     * any.
1965     * @return SuperThing
1966     */
1967    private SuperThing parseSuperThing( XmlPullParser parser, boolean strict )
1968        throws IOException, XmlPullParserException
1969    {
1970        String tagName = parser.getName();
1971        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- SuperThing parseSuperThing( XmlPullParser, boolean )
1993
1994    /**
1995     * Method parseThing.
1996     * 
1997     * @param parser a parser object.
1998     * @param strict a strict object.
1999     * @throws IOException IOException if any.
2000     * @throws XmlPullParserException XmlPullParserException if
2001     * any.
2002     * @return Thing
2003     */
2004    private Thing parseThing( XmlPullParser parser, boolean strict )
2005        throws IOException, XmlPullParserException
2006    {
2007        String tagName = parser.getName();
2008        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- Thing parseThing( XmlPullParser, boolean )
2191
2192    /**
2193     * Method parseThingy.
2194     * 
2195     * @param parser a parser object.
2196     * @param strict a strict object.
2197     * @throws IOException IOException if any.
2198     * @throws XmlPullParserException XmlPullParserException if
2199     * any.
2200     * @return Thingy
2201     */
2202    private Thingy parseThingy( XmlPullParser parser, boolean strict )
2203        throws IOException, XmlPullParserException
2204    {
2205        String tagName = parser.getName();
2206        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2215            }
2216            else
2217            {
2218                checkUnknownAttribute( parser, name, tagName, strict );
2219            }
2220        }
2221        thingy.setSomeContent( interpolatedTrimmed( parser.nextText(), "someContent" ) );
2222        return thingy;
2223    } //-- Thingy parseThingy( XmlPullParser, boolean )
2224
2225    /**
2226     * Method parseXdocFeatures.
2227     * 
2228     * @param parser a parser object.
2229     * @param strict a strict object.
2230     * @throws IOException IOException if any.
2231     * @throws XmlPullParserException XmlPullParserException if
2232     * any.
2233     * @return XdocFeatures
2234     */
2235    private XdocFeatures parseXdocFeatures( XmlPullParser parser, boolean strict )
2236        throws IOException, XmlPullParserException
2237    {
2238        String tagName = parser.getName();
2239        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XdocFeatures parseXdocFeatures( XmlPullParser, boolean )
2276
2277    /**
2278     * Method parseXmlAttributes.
2279     * 
2280     * @param parser a parser object.
2281     * @param strict a strict object.
2282     * @throws IOException IOException if any.
2283     * @throws XmlPullParserException XmlPullParserException if
2284     * any.
2285     * @return XmlAttributes
2286     */
2287    private XmlAttributes parseXmlAttributes( XmlPullParser parser, boolean strict )
2288        throws IOException, XmlPullParserException
2289    {
2290        String tagName = parser.getName();
2291        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlAttributes parseXmlAttributes( XmlPullParser, boolean )
2358
2359    /**
2360     * Method parseXmlContent.
2361     * 
2362     * @param parser a parser object.
2363     * @param strict a strict object.
2364     * @throws IOException IOException if any.
2365     * @throws XmlPullParserException XmlPullParserException if
2366     * any.
2367     * @return XmlContent
2368     */
2369    private XmlContent parseXmlContent( XmlPullParser parser, boolean strict )
2370        throws IOException, XmlPullParserException
2371    {
2372        String tagName = parser.getName();
2373        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlContent parseXmlContent( XmlPullParser, boolean )
2406
2407    /**
2408     * Method parseXmlContentLong.
2409     * 
2410     * @param parser a parser object.
2411     * @param strict a strict object.
2412     * @throws IOException IOException if any.
2413     * @throws XmlPullParserException XmlPullParserException if
2414     * any.
2415     * @return XmlContentLong
2416     */
2417    private XmlContentLong parseXmlContentLong( XmlPullParser parser, boolean strict )
2418        throws IOException, XmlPullParserException
2419    {
2420        String tagName = parser.getName();
2421        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlContentLong parseXmlContentLong( XmlPullParser, boolean )
2439
2440    /**
2441     * Method parseXmlContentLongWithAttributes.
2442     * 
2443     * @param parser a parser object.
2444     * @param strict a strict object.
2445     * @throws IOException IOException if any.
2446     * @throws XmlPullParserException XmlPullParserException if
2447     * any.
2448     * @return XmlContentLongWithAttributes
2449     */
2450    private XmlContentLongWithAttributes parseXmlContentLongWithAttributes( XmlPullParser parser, boolean strict )
2451        throws IOException, XmlPullParserException
2452    {
2453        String tagName = parser.getName();
2454        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlContentLongWithAttributes parseXmlContentLongWithAttributes( XmlPullParser, boolean )
2480
2481    /**
2482     * Method parseXmlFeatures.
2483     * 
2484     * @param parser a parser object.
2485     * @param strict a strict object.
2486     * @throws IOException IOException if any.
2487     * @throws XmlPullParserException XmlPullParserException if
2488     * any.
2489     * @return XmlFeatures
2490     */
2491    private XmlFeatures parseXmlFeatures( XmlPullParser parser, boolean strict )
2492        throws IOException, XmlPullParserException
2493    {
2494        String tagName = parser.getName();
2495        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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                        // explode mode.
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    } //-- XmlFeatures parseXmlFeatures( XmlPullParser, boolean )
2684
2685    /**
2686     * Method parseXmlFieldsOrder.
2687     * 
2688     * @param parser a parser object.
2689     * @param strict a strict object.
2690     * @throws IOException IOException if any.
2691     * @throws XmlPullParserException XmlPullParserException if
2692     * any.
2693     * @return XmlFieldsOrder
2694     */
2695    private XmlFieldsOrder parseXmlFieldsOrder( XmlPullParser parser, boolean strict )
2696        throws IOException, XmlPullParserException
2697    {
2698        String tagName = parser.getName();
2699        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlFieldsOrder parseXmlFieldsOrder( XmlPullParser, boolean )
2752
2753    /**
2754     * Method parseXmlFieldsOrderParent.
2755     * 
2756     * @param parser a parser object.
2757     * @param strict a strict object.
2758     * @throws IOException IOException if any.
2759     * @throws XmlPullParserException XmlPullParserException if
2760     * any.
2761     * @return XmlFieldsOrderParent
2762     */
2763    private XmlFieldsOrderParent parseXmlFieldsOrderParent( XmlPullParser parser, boolean strict )
2764        throws IOException, XmlPullParserException
2765    {
2766        String tagName = parser.getName();
2767        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlFieldsOrderParent parseXmlFieldsOrderParent( XmlPullParser, boolean )
2808
2809    /**
2810     * Method parseXmlFieldsOrderParent2.
2811     * 
2812     * @param parser a parser object.
2813     * @param strict a strict object.
2814     * @throws IOException IOException if any.
2815     * @throws XmlPullParserException XmlPullParserException if
2816     * any.
2817     * @return XmlFieldsOrderParent2
2818     */
2819    private XmlFieldsOrderParent2 parseXmlFieldsOrderParent2( XmlPullParser parser, boolean strict )
2820        throws IOException, XmlPullParserException
2821    {
2822        String tagName = parser.getName();
2823        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlFieldsOrderParent2 parseXmlFieldsOrderParent2( XmlPullParser, boolean )
2852
2853    /**
2854     * Method parseXmlTransientFields.
2855     * 
2856     * @param parser a parser object.
2857     * @param strict a strict object.
2858     * @throws IOException IOException if any.
2859     * @throws XmlPullParserException XmlPullParserException if
2860     * any.
2861     * @return XmlTransientFields
2862     */
2863    private XmlTransientFields parseXmlTransientFields( XmlPullParser parser, boolean strict )
2864        throws IOException, XmlPullParserException
2865    {
2866        String tagName = parser.getName();
2867        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XmlTransientFields parseXmlTransientFields( XmlPullParser, boolean )
2896
2897    /**
2898     * Method parseXsdFeatures.
2899     * 
2900     * @param parser a parser object.
2901     * @param strict a strict object.
2902     * @throws IOException IOException if any.
2903     * @throws XmlPullParserException XmlPullParserException if
2904     * any.
2905     * @return XsdFeatures
2906     */
2907    private XsdFeatures parseXsdFeatures( XmlPullParser parser, boolean strict )
2908        throws IOException, XmlPullParserException
2909    {
2910        String tagName = parser.getName();
2911        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                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
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    } //-- XsdFeatures parseXsdFeatures( XmlPullParser, boolean )
2937
2938    /**
2939     * Sets the state of the "add default entities" flag.
2940     * 
2941     * @param addDefaultEntities a addDefaultEntities object.
2942     */
2943    public void setAddDefaultEntities( boolean addDefaultEntities )
2944    {
2945        this.addDefaultEntities = addDefaultEntities;
2946    } //-- void setAddDefaultEntities( boolean )
2947
2948    public static interface ContentTransformer
2949{
2950    /**
2951     * Interpolate the value read from the xpp3 document
2952     * @param source The source value
2953     * @param fieldName A description of the field being interpolated. The implementation may use this to
2954     *                           log stuff.
2955     * @return The interpolated value.
2956     */
2957    String transform( String source, String fieldName );
2958}
2959
2960}