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