001// =================== DO NOT EDIT THIS FILE ====================
002// Generated by Modello 2.3.0,
003// any modifications will be overwritten.
004// ==============================================================
005
006package org.codehaus.modello.test.features.io.stax;
007
008  //---------------------------------/
009 //- Imported classes and packages -/
010//---------------------------------/
011
012import java.io.ByteArrayInputStream;
013import java.io.FileInputStream;
014import java.io.IOException;
015import java.io.InputStream;
016import java.io.InputStreamReader;
017import java.io.Reader;
018import java.io.StringReader;
019import java.io.StringWriter;
020import java.text.DateFormat;
021import java.text.ParsePosition;
022import java.util.Locale;
023import java.util.regex.Matcher;
024import java.util.regex.Pattern;
025import javax.xml.XMLConstants;
026import javax.xml.stream.*;
027import org.codehaus.modello.test.features.Action;
028import org.codehaus.modello.test.features.AnnotationTest;
029import org.codehaus.modello.test.features.ArrayFeatures;
030import org.codehaus.modello.test.features.AssociationFeatures;
031import org.codehaus.modello.test.features.BaseClass;
032import org.codehaus.modello.test.features.BidiInList;
033import org.codehaus.modello.test.features.BidiInSet;
034import org.codehaus.modello.test.features.Bidirectional;
035import org.codehaus.modello.test.features.ContentTest;
036import org.codehaus.modello.test.features.DueTo;
037import org.codehaus.modello.test.features.Features;
038import org.codehaus.modello.test.features.File;
039import org.codehaus.modello.test.features.InterfacesFeature;
040import org.codehaus.modello.test.features.JavaFeatures;
041import org.codehaus.modello.test.features.NodeItem;
042import org.codehaus.modello.test.features.Reference;
043import org.codehaus.modello.test.features.SimpleInterface;
044import org.codehaus.modello.test.features.SimpleTypes;
045import org.codehaus.modello.test.features.SubClassLevel1;
046import org.codehaus.modello.test.features.SubClassLevel2;
047import org.codehaus.modello.test.features.SubClassLevel3;
048import org.codehaus.modello.test.features.SubInterface;
049import org.codehaus.modello.test.features.SuperThing;
050import org.codehaus.modello.test.features.Thing;
051import org.codehaus.modello.test.features.Thingy;
052import org.codehaus.modello.test.features.XdocFeatures;
053import org.codehaus.modello.test.features.XmlAttributes;
054import org.codehaus.modello.test.features.XmlContent;
055import org.codehaus.modello.test.features.XmlContentLong;
056import org.codehaus.modello.test.features.XmlContentLongWithAttributes;
057import org.codehaus.modello.test.features.XmlFeatures;
058import org.codehaus.modello.test.features.XmlFieldsOrder;
059import org.codehaus.modello.test.features.XmlFieldsOrderParent;
060import org.codehaus.modello.test.features.XmlFieldsOrderParent2;
061import org.codehaus.modello.test.features.XmlTransientFields;
062import org.codehaus.modello.test.features.XsdFeatures;
063import org.codehaus.modello.test.features.other.PackageNameFeature;
064import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
065import org.codehaus.plexus.util.xml.Xpp3Dom;
066
067/**
068 * Class ModelloFeaturesTestStaxReader.
069 * 
070 * @version $Revision$ $Date$
071 */
072@SuppressWarnings( "all" )
073public class ModelloFeaturesTestStaxReader
074{
075
076      //-----------/
077     //- Methods -/
078    //-----------/
079
080    /**
081     * Method determineVersion.
082     * 
083     * @param reader a reader object.
084     * @throws IOException IOException if any.
085     * @throws XMLStreamException XMLStreamException if any.
086     * @return String
087     */
088    public String determineVersion( Reader reader )
089        throws IOException, XMLStreamException
090    {
091        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader( reader );
092        while ( xmlStreamReader.hasNext() )
093        {
094            int eventType = xmlStreamReader.next();
095            if ( eventType == XMLStreamConstants.START_ELEMENT )
096            {
097                return getVersionFromField( xmlStreamReader );
098            }
099        }
100        throw new XMLStreamException( "Version not found in document", xmlStreamReader.getLocation() );
101    } //-- String determineVersion( Reader )
102
103    /**
104     * Method getVersionFromField.
105     * 
106     * @param xmlStreamReader a xmlStreamReader object.
107     * @throws XMLStreamException XMLStreamException if any.
108     * @return String
109     */
110    private String getVersionFromField( XMLStreamReader xmlStreamReader )
111        throws XMLStreamException
112    {
113        int depth = 0;
114        while ( depth >= 0 )
115        {
116            int eventType = xmlStreamReader.next();
117            if ( eventType == XMLStreamConstants.START_ELEMENT )
118            {
119                if ( depth == 0 && "versionField".equals( xmlStreamReader.getLocalName() ) )
120                {
121                    return xmlStreamReader.getElementText();
122                }
123                depth++;
124            }
125            if ( eventType == XMLStreamConstants.END_ELEMENT )
126            {
127                depth--;
128            }
129        }
130        throw new XMLStreamException( "Field: 'versionField' does not exist in the document.", xmlStreamReader.getLocation() );
131    } //-- String getVersionFromField( XMLStreamReader )
132
133    /**
134     * Method read.
135     * 
136     * @param reader a reader object.
137     * @param strict a strict object.
138     * @throws IOException IOException if any.
139     * @throws XMLStreamException XMLStreamException if any.
140     * @return Features
141     */
142    public Features read( Reader reader, boolean strict )
143        throws IOException, XMLStreamException
144    {
145        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader( reader );
146
147        return read( xmlStreamReader, strict );
148    } //-- Features read( Reader, boolean )
149
150    /**
151     * Method read.
152     * 
153     * @param reader a reader object.
154     * @throws IOException IOException if any.
155     * @throws XMLStreamException XMLStreamException if any.
156     * @return Features
157     */
158    public Features read( Reader reader )
159        throws IOException, XMLStreamException
160    {
161        return read( reader, true );
162    } //-- Features read( Reader )
163
164    /**
165     * Method read.
166     * 
167     * @param stream a stream object.
168     * @param strict a strict object.
169     * @throws IOException IOException if any.
170     * @throws XMLStreamException XMLStreamException if any.
171     * @return Features
172     */
173    public Features read( InputStream stream, boolean strict )
174        throws IOException, XMLStreamException
175    {
176        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader( stream );
177
178        return read( xmlStreamReader, strict );
179    } //-- Features read( InputStream, boolean )
180
181    /**
182     * Method read.
183     * 
184     * @param stream a stream object.
185     * @throws IOException IOException if any.
186     * @throws XMLStreamException XMLStreamException if any.
187     * @return Features
188     */
189    public Features read( InputStream stream )
190        throws IOException, XMLStreamException
191    {
192        return read( stream, true );
193    } //-- Features read( InputStream )
194
195    /**
196     * Method read.
197     * 
198     * @param filePath a filePath object.
199     * @param strict a strict object.
200     * @throws IOException IOException if any.
201     * @throws XMLStreamException XMLStreamException if any.
202     * @return Features
203     */
204    public Features read( String filePath, boolean strict )
205        throws IOException, XMLStreamException
206    {
207        java.io.File file = new java.io.File( filePath );
208        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader( file.toURI().toURL().toExternalForm(), new FileInputStream( file ) );
209
210        return read( xmlStreamReader, strict );
211    } //-- Features read( String, boolean )
212
213    /**
214     * Method read.
215     * 
216     * @param filePath a filePath object.
217     * @throws IOException IOException if any.
218     * @throws XMLStreamException XMLStreamException if any.
219     * @return Features
220     */
221    public Features read( String filePath )
222        throws IOException, XMLStreamException
223    {
224        return read( filePath, true );
225    } //-- Features read( String )
226
227    /**
228     * Method buildDom.
229     * 
230     * @param xmlStreamReader a xmlStreamReader object.
231     * @param trim a trim object.
232     * @throws XMLStreamException XMLStreamException if any.
233     * @return Xpp3Dom
234     */
235    private Xpp3Dom buildDom( XMLStreamReader xmlStreamReader, boolean trim )
236        throws XMLStreamException
237    {
238        java.util.Stack elements = new java.util.Stack();
239        java.util.Stack values = new java.util.Stack();
240        int eventType = xmlStreamReader.getEventType();
241        boolean spacePreserve = false;
242        while ( xmlStreamReader.hasNext() )
243        {
244            if ( eventType == XMLStreamConstants.START_ELEMENT )
245            {
246                spacePreserve = false;
247                String rawName = xmlStreamReader.getLocalName();
248                Xpp3Dom element = new Xpp3Dom( rawName );
249                if ( !elements.empty() )
250                {
251                    Xpp3Dom parent = (Xpp3Dom) elements.peek();
252                    parent.addChild( element );
253                }
254                elements.push( element );
255                if ( xmlStreamReader.isEndElement() )
256                {
257                    values.push( null );
258                }
259                else
260                {
261                    values.push( new StringBuilder() );
262                }
263                int attributesSize = xmlStreamReader.getAttributeCount();
264                for ( int i = 0; i < attributesSize; i++ )
265                {
266                    String prefix = xmlStreamReader.getAttributePrefix( i );
267                    String localName = xmlStreamReader.getAttributeLocalName( i );
268                    String value = xmlStreamReader.getAttributeValue( i );
269                    if ( XMLConstants.DEFAULT_NS_PREFIX.equals( xmlStreamReader.getAttributeName( i ).getPrefix() ) )
270                    {
271                        element.setAttribute( localName, value );
272                    }
273                    else
274                    {
275                        element.setAttribute( prefix + ':'+ localName , value );
276                    }
277                    spacePreserve = spacePreserve || ( "xml".equals( prefix ) && "space".equals( localName ) && "preserve".equals( value ) );
278                }
279            }
280            else if ( eventType == XMLStreamConstants.CHARACTERS )
281            {
282                StringBuilder valueBuffer = (StringBuilder) values.peek();
283                String text = xmlStreamReader.getText();
284                if ( trim && !spacePreserve )
285                {
286                    text = text.trim();
287                }
288                valueBuffer.append( text );
289            }
290            else if ( eventType == XMLStreamConstants.END_ELEMENT )
291            {
292                Xpp3Dom element = (Xpp3Dom) elements.pop();
293                // this Object could be null if it is a singleton tag
294                Object accumulatedValue = values.pop();
295                if ( element.getChildCount() == 0 )
296                {
297                    element.setValue( ( accumulatedValue == null ) ? null : accumulatedValue.toString() );
298                }
299                if ( values.empty() )
300                {
301                    return element;
302                }
303            }
304            eventType = xmlStreamReader.next();
305        }
306        throw new IllegalStateException( "End of document found before returning to 0 depth" );
307    } //-- Xpp3Dom buildDom( XMLStreamReader, boolean )
308
309    /**
310     * Method checkFieldWithDuplicate.
311     * 
312     * @param xmlStreamReader a xmlStreamReader object.
313     * @param parsed a parsed object.
314     * @param alias a alias object.
315     * @param tagName a tagName object.
316     * @throws XMLStreamException XMLStreamException if any.
317     * @return boolean
318     */
319    private boolean checkFieldWithDuplicate( XMLStreamReader xmlStreamReader, String tagName, String alias, java.util.Set parsed )
320        throws XMLStreamException
321    {
322        if ( !( xmlStreamReader.getLocalName().equals( tagName ) || xmlStreamReader.getLocalName().equals( alias ) ) )
323        {
324            return false;
325        }
326        if ( !parsed.add( tagName ) )
327        {
328            throw new XMLStreamException( "Duplicated tag: '" + tagName + "'", xmlStreamReader.getLocation() );
329        }
330        return true;
331    } //-- boolean checkFieldWithDuplicate( XMLStreamReader, String, String, java.util.Set )
332
333    /**
334     * Method checkUnknownElement.
335     * 
336     * @param xmlStreamReader a xmlStreamReader object.
337     * @param strict a strict object.
338     * @throws XMLStreamException XMLStreamException if any.
339     */
340    private void checkUnknownElement( XMLStreamReader xmlStreamReader, boolean strict )
341        throws XMLStreamException
342    {
343        if ( strict )
344        {
345            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
346        }
347        int unrecognizedTagCount = 1;
348        while( unrecognizedTagCount != 0 )
349        {
350            xmlStreamReader.next();
351            if ( xmlStreamReader.getEventType() == XMLStreamConstants.START_ELEMENT )
352            {
353                unrecognizedTagCount++;
354            }
355            else if ( xmlStreamReader.getEventType() == XMLStreamConstants.END_ELEMENT )
356            {
357                unrecognizedTagCount--;
358            }
359        }
360    } //-- void checkUnknownElement( XMLStreamReader, boolean )
361
362    /**
363     * Method getBooleanValue.
364     * 
365     * @param s a s object.
366     * @param xmlStreamReader a xmlStreamReader object.
367     * @param attribute a attribute object.
368     * @throws XMLStreamException XMLStreamException if any.
369     * @return boolean
370     */
371    private boolean getBooleanValue( String s, String attribute, XMLStreamReader xmlStreamReader )
372        throws XMLStreamException
373    {
374        if ( s != null )
375        {
376            return Boolean.valueOf( s ).booleanValue();
377        }
378        return false;
379    } //-- boolean getBooleanValue( String, String, XMLStreamReader )
380
381    /**
382     * Method getByteValue.
383     * 
384     * @param s a s object.
385     * @param strict a strict object.
386     * @param xmlStreamReader a xmlStreamReader object.
387     * @param attribute a attribute object.
388     * @throws XMLStreamException XMLStreamException if any.
389     * @return byte
390     */
391    private byte getByteValue( String s, String attribute, XMLStreamReader xmlStreamReader, boolean strict )
392        throws XMLStreamException
393    {
394        if ( s != null )
395        {
396            try
397            {
398                return Byte.valueOf( s ).byteValue();
399            }
400            catch ( NumberFormatException nfe )
401            {
402                if ( strict )
403                {
404                    throw new XMLStreamException( "Unable to parse element '" + attribute + "', must be a byte but was '" + s + "'", xmlStreamReader.getLocation(), nfe );
405                }
406            }
407        }
408        return 0;
409    } //-- byte getByteValue( String, String, XMLStreamReader, boolean )
410
411    /**
412     * Method getCharacterValue.
413     * 
414     * @param s a s object.
415     * @param xmlStreamReader a xmlStreamReader object.
416     * @param attribute a attribute object.
417     * @throws XMLStreamException XMLStreamException if any.
418     * @return char
419     */
420    private char getCharacterValue( String s, String attribute, XMLStreamReader xmlStreamReader )
421        throws XMLStreamException
422    {
423        if ( s != null )
424        {
425            return s.charAt( 0 );
426        }
427        return 0;
428    } //-- char getCharacterValue( String, String, XMLStreamReader )
429
430    /**
431     * Method getDateValue.
432     * 
433     * @param s a s object.
434     * @param xmlStreamReader a xmlStreamReader object.
435     * @param dateFormat a dateFormat object.
436     * @param attribute a attribute object.
437     * @throws XMLStreamException XMLStreamException if any.
438     * @return Date
439     */
440    private java.util.Date getDateValue( String s, String attribute, String dateFormat, XMLStreamReader xmlStreamReader )
441        throws XMLStreamException
442    {
443        if ( s != null )
444        {
445            String effectiveDateFormat = dateFormat;
446            if ( dateFormat == null )
447            {
448                effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
449            }
450            if ( "long".equals( effectiveDateFormat ) )
451            {
452                try
453                {
454                    return new java.util.Date( Long.parseLong( s ) );
455                }
456                catch ( NumberFormatException e )
457                {
458                    throw new XMLStreamException( e.getMessage(), xmlStreamReader.getLocation(), e );
459                }
460            }
461            else
462            {
463                try
464                {
465                    DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
466                    return dateParser.parse( s );
467                }
468                catch ( java.text.ParseException e )
469                {
470                    throw new XMLStreamException( e.getMessage(), xmlStreamReader.getLocation(), e );
471                }
472            }
473        }
474        return null;
475    } //-- java.util.Date getDateValue( String, String, String, XMLStreamReader )
476
477    /**
478     * Method getDefaultValue.
479     * 
480     * @param s a s object.
481     * @param v a v object.
482     * @return String
483     */
484    private String getDefaultValue( String s, String v )
485    {
486        if ( s == null )
487        {
488            s = v;
489        }
490        return s;
491    } //-- String getDefaultValue( String, String )
492
493    /**
494     * Method getDoubleValue.
495     * 
496     * @param s a s object.
497     * @param strict a strict object.
498     * @param xmlStreamReader a xmlStreamReader object.
499     * @param attribute a attribute object.
500     * @throws XMLStreamException XMLStreamException if any.
501     * @return double
502     */
503    private double getDoubleValue( String s, String attribute, XMLStreamReader xmlStreamReader, boolean strict )
504        throws XMLStreamException
505    {
506        if ( s != null )
507        {
508            try
509            {
510                return Double.valueOf( s ).doubleValue();
511            }
512            catch ( NumberFormatException nfe )
513            {
514                if ( strict )
515                {
516                    throw new XMLStreamException( "Unable to parse element '" + attribute + "', must be a floating point number but was '" + s + "'", xmlStreamReader.getLocation(), nfe );
517                }
518            }
519        }
520        return 0;
521    } //-- double getDoubleValue( String, String, XMLStreamReader, boolean )
522
523    /**
524     * Method getFloatValue.
525     * 
526     * @param s a s object.
527     * @param strict a strict object.
528     * @param xmlStreamReader a xmlStreamReader object.
529     * @param attribute a attribute object.
530     * @throws XMLStreamException XMLStreamException if any.
531     * @return float
532     */
533    private float getFloatValue( String s, String attribute, XMLStreamReader xmlStreamReader, boolean strict )
534        throws XMLStreamException
535    {
536        if ( s != null )
537        {
538            try
539            {
540                return Float.valueOf( s ).floatValue();
541            }
542            catch ( NumberFormatException nfe )
543            {
544                if ( strict )
545                {
546                    throw new XMLStreamException( "Unable to parse element '" + attribute + "', must be a floating point number but was '" + s + "'", xmlStreamReader.getLocation(), nfe );
547                }
548            }
549        }
550        return 0;
551    } //-- float getFloatValue( String, String, XMLStreamReader, boolean )
552
553    /**
554     * Method getIntegerValue.
555     * 
556     * @param s a s object.
557     * @param strict a strict object.
558     * @param xmlStreamReader a xmlStreamReader object.
559     * @param attribute a attribute object.
560     * @throws XMLStreamException XMLStreamException if any.
561     * @return int
562     */
563    private int getIntegerValue( String s, String attribute, XMLStreamReader xmlStreamReader, boolean strict )
564        throws XMLStreamException
565    {
566        if ( s != null )
567        {
568            try
569            {
570                return Integer.valueOf( s ).intValue();
571            }
572            catch ( NumberFormatException nfe )
573            {
574                if ( strict )
575                {
576                    throw new XMLStreamException( "Unable to parse element '" + attribute + "', must be an integer but was '" + s + "'", xmlStreamReader.getLocation(), nfe );
577                }
578            }
579        }
580        return 0;
581    } //-- int getIntegerValue( String, String, XMLStreamReader, boolean )
582
583    /**
584     * Method getLongValue.
585     * 
586     * @param s a s object.
587     * @param strict a strict object.
588     * @param xmlStreamReader a xmlStreamReader object.
589     * @param attribute a attribute object.
590     * @throws XMLStreamException XMLStreamException if any.
591     * @return long
592     */
593    private long getLongValue( String s, String attribute, XMLStreamReader xmlStreamReader, boolean strict )
594        throws XMLStreamException
595    {
596        if ( s != null )
597        {
598            try
599            {
600                return Long.valueOf( s ).longValue();
601            }
602            catch ( NumberFormatException nfe )
603            {
604                if ( strict )
605                {
606                    throw new XMLStreamException( "Unable to parse element '" + attribute + "', must be a long integer but was '" + s + "'", xmlStreamReader.getLocation(), nfe );
607                }
608            }
609        }
610        return 0;
611    } //-- long getLongValue( String, String, XMLStreamReader, boolean )
612
613    /**
614     * Method getRequiredAttributeValue.
615     * 
616     * @param s a s object.
617     * @param strict a strict object.
618     * @param xmlStreamReader a xmlStreamReader object.
619     * @param attribute a attribute object.
620     * @throws XMLStreamException XMLStreamException if any.
621     * @return String
622     */
623    private String getRequiredAttributeValue( String s, String attribute, XMLStreamReader xmlStreamReader, boolean strict )
624        throws XMLStreamException
625    {
626        if ( s == null )
627        {
628            if ( strict )
629            {
630                throw new XMLStreamException( "Missing required value for attribute '" + attribute + "'", xmlStreamReader.getLocation() );
631            }
632        }
633        return s;
634    } //-- String getRequiredAttributeValue( String, String, XMLStreamReader, boolean )
635
636    /**
637     * Method getShortValue.
638     * 
639     * @param s a s object.
640     * @param strict a strict object.
641     * @param xmlStreamReader a xmlStreamReader object.
642     * @param attribute a attribute object.
643     * @throws XMLStreamException XMLStreamException if any.
644     * @return short
645     */
646    private short getShortValue( String s, String attribute, XMLStreamReader xmlStreamReader, boolean strict )
647        throws XMLStreamException
648    {
649        if ( s != null )
650        {
651            try
652            {
653                return Short.valueOf( s ).shortValue();
654            }
655            catch ( NumberFormatException nfe )
656            {
657                if ( strict )
658                {
659                    throw new XMLStreamException( "Unable to parse element '" + attribute + "', must be a short integer but was '" + s + "'", xmlStreamReader.getLocation(), nfe );
660                }
661            }
662        }
663        return 0;
664    } //-- short getShortValue( String, String, XMLStreamReader, boolean )
665
666    /**
667     * Method getTrimmedValue.
668     * 
669     * @param s a s object.
670     * @return String
671     */
672    private String getTrimmedValue( String s )
673    {
674        if ( s != null )
675        {
676            s = s.trim();
677        }
678        return s;
679    } //-- String getTrimmedValue( String )
680
681    /**
682     * Method nextTag.
683     * 
684     * @param xmlStreamReader a xmlStreamReader object.
685     * @throws XMLStreamException XMLStreamException if any.
686     * @return int
687     */
688    private int nextTag( XMLStreamReader xmlStreamReader )
689        throws XMLStreamException
690    {
691        while ( true )
692        {
693            int eventType = xmlStreamReader.next();
694            switch ( eventType )
695            {
696                case XMLStreamConstants.CHARACTERS:
697                case XMLStreamConstants.CDATA:
698                case XMLStreamConstants.SPACE:
699                case XMLStreamConstants.PROCESSING_INSTRUCTION:
700                case XMLStreamConstants.COMMENT:
701                    break;
702                case XMLStreamConstants.START_ELEMENT:
703                case XMLStreamConstants.END_ELEMENT:
704                    return eventType;
705                default:
706                    throw new XMLStreamException( "expected start or end tag", xmlStreamReader.getLocation() );
707            }
708        }
709    } //-- int nextTag( XMLStreamReader )
710
711    /**
712     * Method parseAction.
713     * 
714     * @param xmlStreamReader a xmlStreamReader object.
715     * @param strict a strict object.
716     * @throws IOException IOException if any.
717     * @throws XMLStreamException XMLStreamException if any.
718     * @return Action
719     */
720    private Action parseAction( XMLStreamReader xmlStreamReader, boolean strict )
721        throws IOException, XMLStreamException
722    {
723        Action action = new Action();
724        action.setDev( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "dev" ) ) );
725        action.setAction( getTrimmedValue( xmlStreamReader.getElementText() ) );
726        return action;
727    } //-- Action parseAction( XMLStreamReader, boolean )
728
729    /**
730     * Method parseAnnotationTest.
731     * 
732     * @param xmlStreamReader a xmlStreamReader object.
733     * @param strict a strict object.
734     * @throws IOException IOException if any.
735     * @throws XMLStreamException XMLStreamException if any.
736     * @return AnnotationTest
737     */
738    private AnnotationTest parseAnnotationTest( XMLStreamReader xmlStreamReader, boolean strict )
739        throws IOException, XMLStreamException
740    {
741        AnnotationTest annotationTest = new AnnotationTest();
742        java.util.Set parsed = new java.util.HashSet();
743        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
744        {
745            if ( checkFieldWithDuplicate( xmlStreamReader, "anyField", null, parsed ) )
746            {
747                annotationTest.setAnyField( getTrimmedValue( xmlStreamReader.getElementText() ) );
748            }
749            else
750            {
751                checkUnknownElement( xmlStreamReader, strict );
752            }
753        }
754        return annotationTest;
755    } //-- AnnotationTest parseAnnotationTest( XMLStreamReader, boolean )
756
757    /**
758     * Method parseArrayFeatures.
759     * 
760     * @param xmlStreamReader a xmlStreamReader object.
761     * @param strict a strict object.
762     * @throws IOException IOException if any.
763     * @throws XMLStreamException XMLStreamException if any.
764     * @return ArrayFeatures
765     */
766    private ArrayFeatures parseArrayFeatures( XMLStreamReader xmlStreamReader, boolean strict )
767        throws IOException, XMLStreamException
768    {
769        ArrayFeatures arrayFeatures = new ArrayFeatures();
770        java.util.Set parsed = new java.util.HashSet();
771        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
772        {
773            checkUnknownElement( xmlStreamReader, strict );
774        }
775        return arrayFeatures;
776    } //-- ArrayFeatures parseArrayFeatures( XMLStreamReader, boolean )
777
778    /**
779     * Method parseAssociationFeatures.
780     * 
781     * @param xmlStreamReader a xmlStreamReader object.
782     * @param strict a strict object.
783     * @throws IOException IOException if any.
784     * @throws XMLStreamException XMLStreamException if any.
785     * @return AssociationFeatures
786     */
787    private AssociationFeatures parseAssociationFeatures( XMLStreamReader xmlStreamReader, boolean strict )
788        throws IOException, XMLStreamException
789    {
790        AssociationFeatures associationFeatures = new AssociationFeatures();
791        java.util.Set parsed = new java.util.HashSet();
792        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
793        {
794            if ( checkFieldWithDuplicate( xmlStreamReader, "listReferences", null, parsed ) )
795            {
796                java.util.List listReferences = new java.util.ArrayList/*<Reference>*/();
797                associationFeatures.setListReferences( listReferences );
798                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
799                {
800                    if ( "listReference".equals( xmlStreamReader.getLocalName() ) )
801                    {
802                        associationFeatures.addListReference( parseReference( xmlStreamReader, strict ) );
803                    }
804                    else
805                    {
806                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
807                    }
808                }
809            }
810            else if ( checkFieldWithDuplicate( xmlStreamReader, "setReferences", null, parsed ) )
811            {
812                java.util.Set setReferences = new java.util.HashSet/*<Reference>*/();
813                associationFeatures.setSetReferences( setReferences );
814                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
815                {
816                    if ( "setReference".equals( xmlStreamReader.getLocalName() ) )
817                    {
818                        associationFeatures.addSetReference( parseReference( xmlStreamReader, strict ) );
819                    }
820                    else
821                    {
822                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
823                    }
824                }
825            }
826            else if ( checkFieldWithDuplicate( xmlStreamReader, "listStrings", null, parsed ) )
827            {
828                java.util.List listStrings = new java.util.ArrayList/*<String>*/();
829                associationFeatures.setListStrings( listStrings );
830                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
831                {
832                    if ( "listString".equals( xmlStreamReader.getLocalName() ) )
833                    {
834                        listStrings.add( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "new java.util.ArrayList/*<String>*/()" ) ) );
835                    }
836                    else
837                    {
838                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
839                    }
840                }
841            }
842            else if ( checkFieldWithDuplicate( xmlStreamReader, "setStrings", null, parsed ) )
843            {
844                java.util.Set setStrings = new java.util.HashSet/*<String>*/();
845                associationFeatures.setSetStrings( setStrings );
846                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
847                {
848                    if ( "setString".equals( xmlStreamReader.getLocalName() ) )
849                    {
850                        setStrings.add( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "new java.util.HashSet/*<String>*/()" ) ) );
851                    }
852                    else
853                    {
854                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
855                    }
856                }
857            }
858            else if ( checkFieldWithDuplicate( xmlStreamReader, "properties", null, parsed ) )
859            {
860                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
861                {
862                    String key = xmlStreamReader.getLocalName();
863                    String value = xmlStreamReader.getElementText().trim();
864                    associationFeatures.addProperty( key, value );
865                }
866            }
867            else if ( checkFieldWithDuplicate( xmlStreamReader, "bidi", null, parsed ) )
868            {
869                associationFeatures.setBidi( parseBidirectional( xmlStreamReader, strict ) );
870            }
871            else if ( checkFieldWithDuplicate( xmlStreamReader, "listOfBidis", null, parsed ) )
872            {
873                java.util.List listOfBidis = new java.util.ArrayList/*<BidiInList>*/();
874                associationFeatures.setListOfBidis( listOfBidis );
875                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
876                {
877                    if ( "listOfBidi".equals( xmlStreamReader.getLocalName() ) )
878                    {
879                        associationFeatures.addListOfBidi( parseBidiInList( xmlStreamReader, strict ) );
880                    }
881                    else
882                    {
883                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
884                    }
885                }
886            }
887            else if ( checkFieldWithDuplicate( xmlStreamReader, "setOfBidis", null, parsed ) )
888            {
889                java.util.Set setOfBidis = new java.util.HashSet/*<BidiInSet>*/();
890                associationFeatures.setSetOfBidis( setOfBidis );
891                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
892                {
893                    if ( "setOfBidi".equals( xmlStreamReader.getLocalName() ) )
894                    {
895                        associationFeatures.addSetOfBidi( parseBidiInSet( xmlStreamReader, strict ) );
896                    }
897                    else
898                    {
899                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
900                    }
901                }
902            }
903            else
904            {
905                checkUnknownElement( xmlStreamReader, strict );
906            }
907        }
908        return associationFeatures;
909    } //-- AssociationFeatures parseAssociationFeatures( XMLStreamReader, boolean )
910
911    /**
912     * Method parseBaseClass.
913     * 
914     * @param xmlStreamReader a xmlStreamReader object.
915     * @param strict a strict object.
916     * @throws IOException IOException if any.
917     * @throws XMLStreamException XMLStreamException if any.
918     * @return BaseClass
919     */
920    private BaseClass parseBaseClass( XMLStreamReader xmlStreamReader, boolean strict )
921        throws IOException, XMLStreamException
922    {
923        BaseClass baseClass = new BaseClass();
924        java.util.Set parsed = new java.util.HashSet();
925        baseClass.setBaseAttribute( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "baseAttribute" ), "0" ) ), "baseAttribute", xmlStreamReader, strict ) );
926        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
927        {
928            if ( checkFieldWithDuplicate( xmlStreamReader, "baseElement", null, parsed ) )
929            {
930                baseClass.setBaseElement( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "baseElement", xmlStreamReader, strict ) );
931            }
932            else
933            {
934                checkUnknownElement( xmlStreamReader, strict );
935            }
936        }
937        return baseClass;
938    } //-- BaseClass parseBaseClass( XMLStreamReader, boolean )
939
940    /**
941     * Method parseBidiInList.
942     * 
943     * @param xmlStreamReader a xmlStreamReader object.
944     * @param strict a strict object.
945     * @throws IOException IOException if any.
946     * @throws XMLStreamException XMLStreamException if any.
947     * @return BidiInList
948     */
949    private BidiInList parseBidiInList( XMLStreamReader xmlStreamReader, boolean strict )
950        throws IOException, XMLStreamException
951    {
952        BidiInList bidiInList = new BidiInList();
953        java.util.Set parsed = new java.util.HashSet();
954        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
955        {
956            if ( checkFieldWithDuplicate( xmlStreamReader, "parent", null, parsed ) )
957            {
958                bidiInList.setParent( parseAssociationFeatures( xmlStreamReader, strict ) );
959            }
960            else
961            {
962                checkUnknownElement( xmlStreamReader, strict );
963            }
964        }
965        return bidiInList;
966    } //-- BidiInList parseBidiInList( XMLStreamReader, boolean )
967
968    /**
969     * Method parseBidiInSet.
970     * 
971     * @param xmlStreamReader a xmlStreamReader object.
972     * @param strict a strict object.
973     * @throws IOException IOException if any.
974     * @throws XMLStreamException XMLStreamException if any.
975     * @return BidiInSet
976     */
977    private BidiInSet parseBidiInSet( XMLStreamReader xmlStreamReader, boolean strict )
978        throws IOException, XMLStreamException
979    {
980        BidiInSet bidiInSet = new BidiInSet();
981        java.util.Set parsed = new java.util.HashSet();
982        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
983        {
984            if ( checkFieldWithDuplicate( xmlStreamReader, "parent", null, parsed ) )
985            {
986                bidiInSet.setParent( parseAssociationFeatures( xmlStreamReader, strict ) );
987            }
988            else
989            {
990                checkUnknownElement( xmlStreamReader, strict );
991            }
992        }
993        return bidiInSet;
994    } //-- BidiInSet parseBidiInSet( XMLStreamReader, boolean )
995
996    /**
997     * Method parseBidirectional.
998     * 
999     * @param xmlStreamReader a xmlStreamReader object.
1000     * @param strict a strict object.
1001     * @throws IOException IOException if any.
1002     * @throws XMLStreamException XMLStreamException if any.
1003     * @return Bidirectional
1004     */
1005    private Bidirectional parseBidirectional( XMLStreamReader xmlStreamReader, boolean strict )
1006        throws IOException, XMLStreamException
1007    {
1008        Bidirectional bidirectional = new Bidirectional();
1009        java.util.Set parsed = new java.util.HashSet();
1010        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1011        {
1012            if ( checkFieldWithDuplicate( xmlStreamReader, "parent", null, parsed ) )
1013            {
1014                bidirectional.setParent( parseAssociationFeatures( xmlStreamReader, strict ) );
1015            }
1016            else
1017            {
1018                checkUnknownElement( xmlStreamReader, strict );
1019            }
1020        }
1021        return bidirectional;
1022    } //-- Bidirectional parseBidirectional( XMLStreamReader, boolean )
1023
1024    /**
1025     * Method parseContentTest.
1026     * 
1027     * @param xmlStreamReader a xmlStreamReader object.
1028     * @param strict a strict object.
1029     * @throws IOException IOException if any.
1030     * @throws XMLStreamException XMLStreamException if any.
1031     * @return ContentTest
1032     */
1033    private ContentTest parseContentTest( XMLStreamReader xmlStreamReader, boolean strict )
1034        throws IOException, XMLStreamException
1035    {
1036        ContentTest contentTest = new ContentTest();
1037        contentTest.setAttr( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "attr" ) ) );
1038        contentTest.setAttr2( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "attr2" ), "0" ) ), "attr2", xmlStreamReader, strict ) );
1039        contentTest.setContent( getTrimmedValue( xmlStreamReader.getElementText() ) );
1040        return contentTest;
1041    } //-- ContentTest parseContentTest( XMLStreamReader, boolean )
1042
1043    /**
1044     * Method parseDueTo.
1045     * 
1046     * @param xmlStreamReader a xmlStreamReader object.
1047     * @param strict a strict object.
1048     * @throws IOException IOException if any.
1049     * @throws XMLStreamException XMLStreamException if any.
1050     * @return DueTo
1051     */
1052    private DueTo parseDueTo( XMLStreamReader xmlStreamReader, boolean strict )
1053        throws IOException, XMLStreamException
1054    {
1055        DueTo dueTo = new DueTo();
1056        java.util.Set parsed = new java.util.HashSet();
1057        dueTo.setName( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "name" ) ) );
1058        dueTo.setEmail( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "email" ) ) );
1059        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1060        {
1061            checkUnknownElement( xmlStreamReader, strict );
1062        }
1063        return dueTo;
1064    } //-- DueTo parseDueTo( XMLStreamReader, boolean )
1065
1066    /**
1067     * Method parseFeatures.
1068     * 
1069     * @param xmlStreamReader a xmlStreamReader object.
1070     * @param strict a strict object.
1071     * @throws IOException IOException if any.
1072     * @throws XMLStreamException XMLStreamException if any.
1073     * @return Features
1074     */
1075    private Features parseFeatures( XMLStreamReader xmlStreamReader, boolean strict )
1076        throws IOException, XMLStreamException
1077    {
1078        Features features = new Features();
1079        java.util.Set parsed = new java.util.HashSet();
1080        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1081        {
1082            if ( checkFieldWithDuplicate( xmlStreamReader, "versionField", null, parsed ) )
1083            {
1084                features.setVersionField( getTrimmedValue( xmlStreamReader.getElementText() ) );
1085                String modelVersion = features.getVersionField();
1086                // legacy hack for pomVersion == 3
1087                if ( "3".equals( modelVersion ) )
1088                {
1089                    modelVersion = "3.0.0";
1090                }
1091                if ( !"1.0.0".equals( modelVersion ) )
1092                {
1093                    throw new XMLStreamException( "Document model version of '" + modelVersion + "' doesn't match reader version of '1.0.0'", xmlStreamReader.getLocation() );
1094                }
1095            }
1096            else if ( checkFieldWithDuplicate( xmlStreamReader, "comment", null, parsed ) )
1097            {
1098                features.setComment( getTrimmedValue( xmlStreamReader.getElementText() ) );
1099            }
1100            else if ( checkFieldWithDuplicate( xmlStreamReader, "description", null, parsed ) )
1101            {
1102                features.setDescription( getTrimmedValue( xmlStreamReader.getElementText() ) );
1103            }
1104            else if ( checkFieldWithDuplicate( xmlStreamReader, "required", null, parsed ) )
1105            {
1106                features.setRequired( getTrimmedValue( xmlStreamReader.getElementText() ) );
1107            }
1108            else if ( checkFieldWithDuplicate( xmlStreamReader, "identifier", null, parsed ) )
1109            {
1110                features.setIdentifier( getTrimmedValue( xmlStreamReader.getElementText() ) );
1111            }
1112            else if ( checkFieldWithDuplicate( xmlStreamReader, "identifierPart2", null, parsed ) )
1113            {
1114                features.setIdentifierPart2( parseReference( xmlStreamReader, strict ) );
1115            }
1116            else if ( checkFieldWithDuplicate( xmlStreamReader, "simpleTypes", null, parsed ) )
1117            {
1118                features.setSimpleTypes( parseSimpleTypes( xmlStreamReader, strict ) );
1119            }
1120            else if ( checkFieldWithDuplicate( xmlStreamReader, "defaultValues", null, parsed ) )
1121            {
1122                features.setDefaultValues( parseSimpleTypes( xmlStreamReader, strict ) );
1123            }
1124            else if ( checkFieldWithDuplicate( xmlStreamReader, "arrays", null, parsed ) )
1125            {
1126                features.setArrays( parseArrayFeatures( xmlStreamReader, strict ) );
1127            }
1128            else if ( checkFieldWithDuplicate( xmlStreamReader, "associationFeatures", null, parsed ) )
1129            {
1130                features.setAssociationFeatures( parseAssociationFeatures( xmlStreamReader, strict ) );
1131            }
1132            else if ( checkFieldWithDuplicate( xmlStreamReader, "javaFeatures", null, parsed ) )
1133            {
1134                features.setJavaFeatures( parseJavaFeatures( xmlStreamReader, strict ) );
1135            }
1136            else if ( checkFieldWithDuplicate( xmlStreamReader, "xmlFeatures", null, parsed ) )
1137            {
1138                features.setXmlFeatures( parseXmlFeatures( xmlStreamReader, strict ) );
1139            }
1140            else if ( checkFieldWithDuplicate( xmlStreamReader, "xdocFeatures", null, parsed ) )
1141            {
1142                features.setXdocFeatures( parseXdocFeatures( xmlStreamReader, strict ) );
1143            }
1144            else if ( checkFieldWithDuplicate( xmlStreamReader, "node", null, parsed ) )
1145            {
1146                features.setNode( parseNodeItem( xmlStreamReader, strict ) );
1147            }
1148            else if ( checkFieldWithDuplicate( xmlStreamReader, "cloneable", null, parsed ) )
1149            {
1150                features.setCloneable( parseThing( xmlStreamReader, strict ) );
1151            }
1152            else if ( checkFieldWithDuplicate( xmlStreamReader, "file", null, parsed ) )
1153            {
1154                features.setFile( parseFile( xmlStreamReader, strict ) );
1155            }
1156            else if ( checkFieldWithDuplicate( xmlStreamReader, "action", null, parsed ) )
1157            {
1158                features.setAction( parseAction( xmlStreamReader, strict ) );
1159            }
1160            else
1161            {
1162                checkUnknownElement( xmlStreamReader, strict );
1163            }
1164        }
1165        return features;
1166    } //-- Features parseFeatures( XMLStreamReader, boolean )
1167
1168    /**
1169     * Method parseFile.
1170     * 
1171     * @param xmlStreamReader a xmlStreamReader object.
1172     * @param strict a strict object.
1173     * @throws IOException IOException if any.
1174     * @throws XMLStreamException XMLStreamException if any.
1175     * @return File
1176     */
1177    private File parseFile( XMLStreamReader xmlStreamReader, boolean strict )
1178        throws IOException, XMLStreamException
1179    {
1180        File file = new File();
1181        java.util.Set parsed = new java.util.HashSet();
1182        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1183        {
1184            if ( checkFieldWithDuplicate( xmlStreamReader, "file", null, parsed ) )
1185            {
1186                file.setFile( getTrimmedValue( xmlStreamReader.getElementText() ) );
1187            }
1188            else
1189            {
1190                checkUnknownElement( xmlStreamReader, strict );
1191            }
1192        }
1193        return file;
1194    } //-- File parseFile( XMLStreamReader, boolean )
1195
1196    /**
1197     * Method parseInterfacesFeature.
1198     * 
1199     * @param xmlStreamReader a xmlStreamReader object.
1200     * @param strict a strict object.
1201     * @throws IOException IOException if any.
1202     * @throws XMLStreamException XMLStreamException if any.
1203     * @return InterfacesFeature
1204     */
1205    private InterfacesFeature parseInterfacesFeature( XMLStreamReader xmlStreamReader, boolean strict )
1206        throws IOException, XMLStreamException
1207    {
1208        InterfacesFeature interfacesFeature = new InterfacesFeature();
1209        java.util.Set parsed = new java.util.HashSet();
1210        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1211        {
1212            if ( checkFieldWithDuplicate( xmlStreamReader, "id", null, parsed ) )
1213            {
1214                interfacesFeature.setId( getTrimmedValue( xmlStreamReader.getElementText() ) );
1215            }
1216            else
1217            {
1218                checkUnknownElement( xmlStreamReader, strict );
1219            }
1220        }
1221        return interfacesFeature;
1222    } //-- InterfacesFeature parseInterfacesFeature( XMLStreamReader, boolean )
1223
1224    /**
1225     * Method parseJavaFeatures.
1226     * 
1227     * @param xmlStreamReader a xmlStreamReader object.
1228     * @param strict a strict object.
1229     * @throws IOException IOException if any.
1230     * @throws XMLStreamException XMLStreamException if any.
1231     * @return JavaFeatures
1232     */
1233    private JavaFeatures parseJavaFeatures( XMLStreamReader xmlStreamReader, boolean strict )
1234        throws IOException, XMLStreamException
1235    {
1236        JavaFeatures javaFeatures = new JavaFeatures();
1237        java.util.Set parsed = new java.util.HashSet();
1238        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1239        {
1240            if ( checkFieldWithDuplicate( xmlStreamReader, "interfaces", null, parsed ) )
1241            {
1242                javaFeatures.setInterfaces( parseInterfacesFeature( xmlStreamReader, strict ) );
1243            }
1244            else if ( checkFieldWithDuplicate( xmlStreamReader, "packageName", null, parsed ) )
1245            {
1246                javaFeatures.setPackageName( parsePackageNameFeature( xmlStreamReader, strict ) );
1247            }
1248            else if ( checkFieldWithDuplicate( xmlStreamReader, "base", null, parsed ) )
1249            {
1250                javaFeatures.setBase( parseBaseClass( xmlStreamReader, strict ) );
1251            }
1252            else if ( checkFieldWithDuplicate( xmlStreamReader, "subClass", null, parsed ) )
1253            {
1254                javaFeatures.setSubClass( parseSubClassLevel1( xmlStreamReader, strict ) );
1255            }
1256            else if ( checkFieldWithDuplicate( xmlStreamReader, "subClass2", null, parsed ) )
1257            {
1258                javaFeatures.setSubClass2( parseSubClassLevel2( xmlStreamReader, strict ) );
1259            }
1260            else if ( checkFieldWithDuplicate( xmlStreamReader, "subClass3", null, parsed ) )
1261            {
1262                javaFeatures.setSubClass3( parseSubClassLevel3( xmlStreamReader, strict ) );
1263            }
1264            else if ( checkFieldWithDuplicate( xmlStreamReader, "annotation", null, parsed ) )
1265            {
1266                javaFeatures.setAnnotation( parseAnnotationTest( xmlStreamReader, strict ) );
1267            }
1268            else
1269            {
1270                checkUnknownElement( xmlStreamReader, strict );
1271            }
1272        }
1273        return javaFeatures;
1274    } //-- JavaFeatures parseJavaFeatures( XMLStreamReader, boolean )
1275
1276    /**
1277     * Method parseNodeItem.
1278     * 
1279     * @param xmlStreamReader a xmlStreamReader object.
1280     * @param strict a strict object.
1281     * @throws IOException IOException if any.
1282     * @throws XMLStreamException XMLStreamException if any.
1283     * @return NodeItem
1284     */
1285    private NodeItem parseNodeItem( XMLStreamReader xmlStreamReader, boolean strict )
1286        throws IOException, XMLStreamException
1287    {
1288        NodeItem nodeItem = new NodeItem();
1289        java.util.Set parsed = new java.util.HashSet();
1290        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1291        {
1292            if ( checkFieldWithDuplicate( xmlStreamReader, "value", null, parsed ) )
1293            {
1294                nodeItem.setValue( getTrimmedValue( xmlStreamReader.getElementText() ) );
1295            }
1296            else if ( checkFieldWithDuplicate( xmlStreamReader, "child", null, parsed ) )
1297            {
1298                nodeItem.setChild( parseNodeItem( xmlStreamReader, strict ) );
1299            }
1300            else
1301            {
1302                checkUnknownElement( xmlStreamReader, strict );
1303            }
1304        }
1305        return nodeItem;
1306    } //-- NodeItem parseNodeItem( XMLStreamReader, boolean )
1307
1308    /**
1309     * Method parsePackageNameFeature.
1310     * 
1311     * @param xmlStreamReader a xmlStreamReader object.
1312     * @param strict a strict object.
1313     * @throws IOException IOException if any.
1314     * @throws XMLStreamException XMLStreamException if any.
1315     * @return PackageNameFeature
1316     */
1317    private PackageNameFeature parsePackageNameFeature( XMLStreamReader xmlStreamReader, boolean strict )
1318        throws IOException, XMLStreamException
1319    {
1320        PackageNameFeature packageNameFeature = new PackageNameFeature();
1321        java.util.Set parsed = new java.util.HashSet();
1322        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1323        {
1324            if ( checkFieldWithDuplicate( xmlStreamReader, "reference", null, parsed ) )
1325            {
1326                packageNameFeature.setReference( parseReference( xmlStreamReader, strict ) );
1327            }
1328            else
1329            {
1330                checkUnknownElement( xmlStreamReader, strict );
1331            }
1332        }
1333        return packageNameFeature;
1334    } //-- PackageNameFeature parsePackageNameFeature( XMLStreamReader, boolean )
1335
1336    /**
1337     * Method parseReference.
1338     * 
1339     * @param xmlStreamReader a xmlStreamReader object.
1340     * @param strict a strict object.
1341     * @throws IOException IOException if any.
1342     * @throws XMLStreamException XMLStreamException if any.
1343     * @return Reference
1344     */
1345    private Reference parseReference( XMLStreamReader xmlStreamReader, boolean strict )
1346        throws IOException, XMLStreamException
1347    {
1348        Reference reference = new Reference();
1349        java.util.Set parsed = new java.util.HashSet();
1350        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1351        {
1352            if ( checkFieldWithDuplicate( xmlStreamReader, "id", "key", parsed ) )
1353            {
1354                reference.setId( getTrimmedValue( xmlStreamReader.getElementText() ) );
1355            }
1356            else
1357            {
1358                checkUnknownElement( xmlStreamReader, strict );
1359            }
1360        }
1361        return reference;
1362    } //-- Reference parseReference( XMLStreamReader, boolean )
1363
1364    /**
1365     * Method parseSimpleTypes.
1366     * 
1367     * @param xmlStreamReader a xmlStreamReader object.
1368     * @param strict a strict object.
1369     * @throws IOException IOException if any.
1370     * @throws XMLStreamException XMLStreamException if any.
1371     * @return SimpleTypes
1372     */
1373    private SimpleTypes parseSimpleTypes( XMLStreamReader xmlStreamReader, boolean strict )
1374        throws IOException, XMLStreamException
1375    {
1376        SimpleTypes simpleTypes = new SimpleTypes();
1377        java.util.Set parsed = new java.util.HashSet();
1378        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1379        {
1380            if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveBoolean", null, parsed ) )
1381            {
1382                simpleTypes.setPrimitiveBoolean( getBooleanValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "true" ) ), "primitiveBoolean", xmlStreamReader ) );
1383            }
1384            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveChar", null, parsed ) )
1385            {
1386                simpleTypes.setPrimitiveChar( getCharacterValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "H" ) ), "primitiveChar", xmlStreamReader ) );
1387            }
1388            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveByte", null, parsed ) )
1389            {
1390                simpleTypes.setPrimitiveByte( getByteValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "12" ) ), "primitiveByte", xmlStreamReader, strict ) );
1391            }
1392            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveShort", null, parsed ) )
1393            {
1394                simpleTypes.setPrimitiveShort( getShortValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "1212" ) ), "primitiveShort", xmlStreamReader, strict ) );
1395            }
1396            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveInt", null, parsed ) )
1397            {
1398                simpleTypes.setPrimitiveInt( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "121212" ) ), "primitiveInt", xmlStreamReader, strict ) );
1399            }
1400            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveLong", null, parsed ) )
1401            {
1402                simpleTypes.setPrimitiveLong( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "1234567890123" ) ), "primitiveLong", xmlStreamReader, strict ) );
1403            }
1404            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveFloat", null, parsed ) )
1405            {
1406                simpleTypes.setPrimitiveFloat( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "12.12" ) ), "primitiveFloat", xmlStreamReader, strict ) );
1407            }
1408            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveDouble", null, parsed ) )
1409            {
1410                simpleTypes.setPrimitiveDouble( getDoubleValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "12.12" ) ), "primitiveDouble", xmlStreamReader, strict ) );
1411            }
1412            else if ( checkFieldWithDuplicate( xmlStreamReader, "objectString", null, parsed ) )
1413            {
1414                simpleTypes.setObjectString( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "default value" ) ) );
1415            }
1416            else if ( checkFieldWithDuplicate( xmlStreamReader, "objectDate", null, parsed ) )
1417            {
1418                String dateFormat = null;
1419                simpleTypes.setObjectDate( getDateValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "2012-12-24T22:12:12.012" ) ), "objectDate", dateFormat, xmlStreamReader ) );
1420            }
1421            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveBooleanNoDefault", null, parsed ) )
1422            {
1423                simpleTypes.setPrimitiveBooleanNoDefault( getBooleanValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "false" ) ), "primitiveBooleanNoDefault", xmlStreamReader ) );
1424            }
1425            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveCharNoDefault", null, parsed ) )
1426            {
1427                simpleTypes.setPrimitiveCharNoDefault( getCharacterValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "" ) ), "primitiveCharNoDefault", xmlStreamReader ) );
1428            }
1429            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveByteNoDefault", null, parsed ) )
1430            {
1431                simpleTypes.setPrimitiveByteNoDefault( getByteValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "primitiveByteNoDefault", xmlStreamReader, strict ) );
1432            }
1433            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveShortNoDefault", null, parsed ) )
1434            {
1435                simpleTypes.setPrimitiveShortNoDefault( getShortValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "primitiveShortNoDefault", xmlStreamReader, strict ) );
1436            }
1437            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveIntNoDefault", null, parsed ) )
1438            {
1439                simpleTypes.setPrimitiveIntNoDefault( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "primitiveIntNoDefault", xmlStreamReader, strict ) );
1440            }
1441            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveLongNoDefault", null, parsed ) )
1442            {
1443                simpleTypes.setPrimitiveLongNoDefault( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "primitiveLongNoDefault", xmlStreamReader, strict ) );
1444            }
1445            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveFloatNoDefault", null, parsed ) )
1446            {
1447                simpleTypes.setPrimitiveFloatNoDefault( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0.0" ) ), "primitiveFloatNoDefault", xmlStreamReader, strict ) );
1448            }
1449            else if ( checkFieldWithDuplicate( xmlStreamReader, "primitiveDoubleNoDefault", null, parsed ) )
1450            {
1451                simpleTypes.setPrimitiveDoubleNoDefault( getDoubleValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0.0" ) ), "primitiveDoubleNoDefault", xmlStreamReader, strict ) );
1452            }
1453            else if ( checkFieldWithDuplicate( xmlStreamReader, "objectStringNoDefault", null, parsed ) )
1454            {
1455                simpleTypes.setObjectStringNoDefault( getTrimmedValue( xmlStreamReader.getElementText() ) );
1456            }
1457            else if ( checkFieldWithDuplicate( xmlStreamReader, "objectDateNoDefault", null, parsed ) )
1458            {
1459                String dateFormat = null;
1460                simpleTypes.setObjectDateNoDefault( getDateValue( getTrimmedValue( xmlStreamReader.getElementText() ), "objectDateNoDefault", dateFormat, xmlStreamReader ) );
1461            }
1462            else if ( checkFieldWithDuplicate( xmlStreamReader, "dom", null, parsed ) )
1463            {
1464                simpleTypes.setDom( buildDom( xmlStreamReader, true ) );
1465            }
1466            else if ( checkFieldWithDuplicate( xmlStreamReader, "content", null, parsed ) )
1467            {
1468                simpleTypes.setContent( parseContentTest( xmlStreamReader, strict ) );
1469            }
1470            else
1471            {
1472                checkUnknownElement( xmlStreamReader, strict );
1473            }
1474        }
1475        return simpleTypes;
1476    } //-- SimpleTypes parseSimpleTypes( XMLStreamReader, boolean )
1477
1478    /**
1479     * Method parseSubClassLevel1.
1480     * 
1481     * @param xmlStreamReader a xmlStreamReader object.
1482     * @param strict a strict object.
1483     * @throws IOException IOException if any.
1484     * @throws XMLStreamException XMLStreamException if any.
1485     * @return SubClassLevel1
1486     */
1487    private SubClassLevel1 parseSubClassLevel1( XMLStreamReader xmlStreamReader, boolean strict )
1488        throws IOException, XMLStreamException
1489    {
1490        SubClassLevel1 subClassLevel1 = new SubClassLevel1();
1491        java.util.Set parsed = new java.util.HashSet();
1492        subClassLevel1.setSubAttribute1( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "subAttribute1" ), "0" ) ), "subAttribute1", xmlStreamReader, strict ) );
1493        subClassLevel1.setBaseAttribute( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "baseAttribute" ), "0" ) ), "baseAttribute", xmlStreamReader, strict ) );
1494        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1495        {
1496            if ( checkFieldWithDuplicate( xmlStreamReader, "subElement1", null, parsed ) )
1497            {
1498                subClassLevel1.setSubElement1( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "subElement1", xmlStreamReader, strict ) );
1499            }
1500            else if ( checkFieldWithDuplicate( xmlStreamReader, "baseElement", null, parsed ) )
1501            {
1502                subClassLevel1.setBaseElement( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "baseElement", xmlStreamReader, strict ) );
1503            }
1504            else
1505            {
1506                checkUnknownElement( xmlStreamReader, strict );
1507            }
1508        }
1509        return subClassLevel1;
1510    } //-- SubClassLevel1 parseSubClassLevel1( XMLStreamReader, boolean )
1511
1512    /**
1513     * Method parseSubClassLevel2.
1514     * 
1515     * @param xmlStreamReader a xmlStreamReader object.
1516     * @param strict a strict object.
1517     * @throws IOException IOException if any.
1518     * @throws XMLStreamException XMLStreamException if any.
1519     * @return SubClassLevel2
1520     */
1521    private SubClassLevel2 parseSubClassLevel2( XMLStreamReader xmlStreamReader, boolean strict )
1522        throws IOException, XMLStreamException
1523    {
1524        SubClassLevel2 subClassLevel2 = new SubClassLevel2();
1525        java.util.Set parsed = new java.util.HashSet();
1526        subClassLevel2.setSubAttribute2( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "subAttribute2" ), "0.0" ) ), "subAttribute2", xmlStreamReader, strict ) );
1527        subClassLevel2.setSubAttribute1( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "subAttribute1" ), "0" ) ), "subAttribute1", xmlStreamReader, strict ) );
1528        subClassLevel2.setBaseAttribute( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "baseAttribute" ), "0" ) ), "baseAttribute", xmlStreamReader, strict ) );
1529        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1530        {
1531            if ( checkFieldWithDuplicate( xmlStreamReader, "subElement2", null, parsed ) )
1532            {
1533                subClassLevel2.setSubElement2( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0.0" ) ), "subElement2", xmlStreamReader, strict ) );
1534            }
1535            else if ( checkFieldWithDuplicate( xmlStreamReader, "subElement1", null, parsed ) )
1536            {
1537                subClassLevel2.setSubElement1( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "subElement1", xmlStreamReader, strict ) );
1538            }
1539            else if ( checkFieldWithDuplicate( xmlStreamReader, "baseElement", null, parsed ) )
1540            {
1541                subClassLevel2.setBaseElement( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "baseElement", xmlStreamReader, strict ) );
1542            }
1543            else
1544            {
1545                checkUnknownElement( xmlStreamReader, strict );
1546            }
1547        }
1548        return subClassLevel2;
1549    } //-- SubClassLevel2 parseSubClassLevel2( XMLStreamReader, boolean )
1550
1551    /**
1552     * Method parseSubClassLevel3.
1553     * 
1554     * @param xmlStreamReader a xmlStreamReader object.
1555     * @param strict a strict object.
1556     * @throws IOException IOException if any.
1557     * @throws XMLStreamException XMLStreamException if any.
1558     * @return SubClassLevel3
1559     */
1560    private SubClassLevel3 parseSubClassLevel3( XMLStreamReader xmlStreamReader, boolean strict )
1561        throws IOException, XMLStreamException
1562    {
1563        SubClassLevel3 subClassLevel3 = new SubClassLevel3();
1564        java.util.Set parsed = new java.util.HashSet();
1565        subClassLevel3.setSubAttribute3( getDoubleValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "subAttribute3" ), "0.0" ) ), "subAttribute3", xmlStreamReader, strict ) );
1566        subClassLevel3.setSubAttribute2( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "subAttribute2" ), "0.0" ) ), "subAttribute2", xmlStreamReader, strict ) );
1567        subClassLevel3.setSubAttribute1( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "subAttribute1" ), "0" ) ), "subAttribute1", xmlStreamReader, strict ) );
1568        subClassLevel3.setBaseAttribute( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "baseAttribute" ), "0" ) ), "baseAttribute", xmlStreamReader, strict ) );
1569        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1570        {
1571            if ( checkFieldWithDuplicate( xmlStreamReader, "subElement3", null, parsed ) )
1572            {
1573                subClassLevel3.setSubElement3( getDoubleValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0.0" ) ), "subElement3", xmlStreamReader, strict ) );
1574            }
1575            else if ( checkFieldWithDuplicate( xmlStreamReader, "subElement2", null, parsed ) )
1576            {
1577                subClassLevel3.setSubElement2( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0.0" ) ), "subElement2", xmlStreamReader, strict ) );
1578            }
1579            else if ( checkFieldWithDuplicate( xmlStreamReader, "subElement1", null, parsed ) )
1580            {
1581                subClassLevel3.setSubElement1( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "subElement1", xmlStreamReader, strict ) );
1582            }
1583            else if ( checkFieldWithDuplicate( xmlStreamReader, "baseElement", null, parsed ) )
1584            {
1585                subClassLevel3.setBaseElement( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "baseElement", xmlStreamReader, strict ) );
1586            }
1587            else
1588            {
1589                checkUnknownElement( xmlStreamReader, strict );
1590            }
1591        }
1592        return subClassLevel3;
1593    } //-- SubClassLevel3 parseSubClassLevel3( XMLStreamReader, boolean )
1594
1595    /**
1596     * Method parseSuperThing.
1597     * 
1598     * @param xmlStreamReader a xmlStreamReader object.
1599     * @param strict a strict object.
1600     * @throws IOException IOException if any.
1601     * @throws XMLStreamException XMLStreamException if any.
1602     * @return SuperThing
1603     */
1604    private SuperThing parseSuperThing( XMLStreamReader xmlStreamReader, boolean strict )
1605        throws IOException, XMLStreamException
1606    {
1607        SuperThing superThing = new SuperThing();
1608        java.util.Set parsed = new java.util.HashSet();
1609        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1610        {
1611            checkUnknownElement( xmlStreamReader, strict );
1612        }
1613        return superThing;
1614    } //-- SuperThing parseSuperThing( XMLStreamReader, boolean )
1615
1616    /**
1617     * Method parseThing.
1618     * 
1619     * @param xmlStreamReader a xmlStreamReader object.
1620     * @param strict a strict object.
1621     * @throws IOException IOException if any.
1622     * @throws XMLStreamException XMLStreamException if any.
1623     * @return Thing
1624     */
1625    private Thing parseThing( XMLStreamReader xmlStreamReader, boolean strict )
1626        throws IOException, XMLStreamException
1627    {
1628        Thing thing = new Thing();
1629        java.util.Set parsed = new java.util.HashSet();
1630        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1631        {
1632            if ( checkFieldWithDuplicate( xmlStreamReader, "someBoolean", null, parsed ) )
1633            {
1634                thing.setSomeBoolean( getBooleanValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "false" ) ), "someBoolean", xmlStreamReader ) );
1635            }
1636            else if ( checkFieldWithDuplicate( xmlStreamReader, "someChar", null, parsed ) )
1637            {
1638                thing.setSomeChar( getCharacterValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "" ) ), "someChar", xmlStreamReader ) );
1639            }
1640            else if ( checkFieldWithDuplicate( xmlStreamReader, "someByte", null, parsed ) )
1641            {
1642                thing.setSomeByte( getByteValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "someByte", xmlStreamReader, strict ) );
1643            }
1644            else if ( checkFieldWithDuplicate( xmlStreamReader, "someShort", null, parsed ) )
1645            {
1646                thing.setSomeShort( getShortValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "someShort", xmlStreamReader, strict ) );
1647            }
1648            else if ( checkFieldWithDuplicate( xmlStreamReader, "someInt", null, parsed ) )
1649            {
1650                thing.setSomeInt( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "someInt", xmlStreamReader, strict ) );
1651            }
1652            else if ( checkFieldWithDuplicate( xmlStreamReader, "someLong", null, parsed ) )
1653            {
1654                thing.setSomeLong( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0" ) ), "someLong", xmlStreamReader, strict ) );
1655            }
1656            else if ( checkFieldWithDuplicate( xmlStreamReader, "someFloat", null, parsed ) )
1657            {
1658                thing.setSomeFloat( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0.0" ) ), "someFloat", xmlStreamReader, strict ) );
1659            }
1660            else if ( checkFieldWithDuplicate( xmlStreamReader, "someDouble", null, parsed ) )
1661            {
1662                thing.setSomeDouble( getDoubleValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "0.0" ) ), "someDouble", xmlStreamReader, strict ) );
1663            }
1664            else if ( checkFieldWithDuplicate( xmlStreamReader, "someString", null, parsed ) )
1665            {
1666                thing.setSomeString( getTrimmedValue( xmlStreamReader.getElementText() ) );
1667            }
1668            else if ( checkFieldWithDuplicate( xmlStreamReader, "someDate", null, parsed ) )
1669            {
1670                String dateFormat = null;
1671                thing.setSomeDate( getDateValue( getTrimmedValue( xmlStreamReader.getElementText() ), "someDate", dateFormat, xmlStreamReader ) );
1672            }
1673            else if ( checkFieldWithDuplicate( xmlStreamReader, "someDom", null, parsed ) )
1674            {
1675                thing.setSomeDom( buildDom( xmlStreamReader, true ) );
1676            }
1677            else if ( checkFieldWithDuplicate( xmlStreamReader, "someProperties", null, parsed ) )
1678            {
1679                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
1680                {
1681                    String key = xmlStreamReader.getLocalName();
1682                    String value = xmlStreamReader.getElementText().trim();
1683                    thing.addSomeProperty( key, value );
1684                }
1685            }
1686            else if ( checkFieldWithDuplicate( xmlStreamReader, "someStringList", null, parsed ) )
1687            {
1688                java.util.List someStringList = new java.util.ArrayList/*<String>*/();
1689                thing.setSomeStringList( someStringList );
1690                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
1691                {
1692                    if ( "someStringList".equals( xmlStreamReader.getLocalName() ) )
1693                    {
1694                        someStringList.add( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "new java.util.ArrayList/*<String>*/()" ) ) );
1695                    }
1696                    else
1697                    {
1698                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
1699                    }
1700                }
1701            }
1702            else if ( checkFieldWithDuplicate( xmlStreamReader, "someStringSet", null, parsed ) )
1703            {
1704                java.util.Set someStringSet = new java.util.HashSet/*<String>*/();
1705                thing.setSomeStringSet( someStringSet );
1706                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
1707                {
1708                    if ( "someStringSet".equals( xmlStreamReader.getLocalName() ) )
1709                    {
1710                        someStringSet.add( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "new java.util.HashSet/*<String>*/()" ) ) );
1711                    }
1712                    else
1713                    {
1714                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
1715                    }
1716                }
1717            }
1718            else if ( checkFieldWithDuplicate( xmlStreamReader, "deepThingy", null, parsed ) )
1719            {
1720                thing.setDeepThingy( parseThingy( xmlStreamReader, strict ) );
1721            }
1722            else if ( checkFieldWithDuplicate( xmlStreamReader, "deepThingyList", null, parsed ) )
1723            {
1724                java.util.List deepThingyList = new java.util.ArrayList/*<Thingy>*/();
1725                thing.setDeepThingyList( deepThingyList );
1726                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
1727                {
1728                    if ( "deepThingyList".equals( xmlStreamReader.getLocalName() ) )
1729                    {
1730                        thing.addDeepThingyList( parseThingy( xmlStreamReader, strict ) );
1731                    }
1732                    else
1733                    {
1734                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
1735                    }
1736                }
1737            }
1738            else if ( checkFieldWithDuplicate( xmlStreamReader, "deepThingySet", null, parsed ) )
1739            {
1740                java.util.Set deepThingySet = new java.util.HashSet/*<Thingy>*/();
1741                thing.setDeepThingySet( deepThingySet );
1742                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
1743                {
1744                    if ( "deepThingySet".equals( xmlStreamReader.getLocalName() ) )
1745                    {
1746                        thing.addDeepThingySet( parseThingy( xmlStreamReader, strict ) );
1747                    }
1748                    else
1749                    {
1750                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
1751                    }
1752                }
1753            }
1754            else if ( checkFieldWithDuplicate( xmlStreamReader, "shallowThingy", null, parsed ) )
1755            {
1756                thing.setShallowThingy( parseThingy( xmlStreamReader, strict ) );
1757            }
1758            else if ( checkFieldWithDuplicate( xmlStreamReader, "shallowThingyList", null, parsed ) )
1759            {
1760                java.util.List shallowThingyList = new java.util.ArrayList/*<Thingy>*/();
1761                thing.setShallowThingyList( shallowThingyList );
1762                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
1763                {
1764                    if ( "shallowThingyList".equals( xmlStreamReader.getLocalName() ) )
1765                    {
1766                        thing.addShallowThingyList( parseThingy( xmlStreamReader, strict ) );
1767                    }
1768                    else
1769                    {
1770                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
1771                    }
1772                }
1773            }
1774            else if ( checkFieldWithDuplicate( xmlStreamReader, "shallowThingySet", null, parsed ) )
1775            {
1776                java.util.Set shallowThingySet = new java.util.HashSet/*<Thingy>*/();
1777                thing.setShallowThingySet( shallowThingySet );
1778                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
1779                {
1780                    if ( "shallowThingySet".equals( xmlStreamReader.getLocalName() ) )
1781                    {
1782                        thing.addShallowThingySet( parseThingy( xmlStreamReader, strict ) );
1783                    }
1784                    else
1785                    {
1786                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
1787                    }
1788                }
1789            }
1790            else
1791            {
1792                checkUnknownElement( xmlStreamReader, strict );
1793            }
1794        }
1795        return thing;
1796    } //-- Thing parseThing( XMLStreamReader, boolean )
1797
1798    /**
1799     * Method parseThingy.
1800     * 
1801     * @param xmlStreamReader a xmlStreamReader object.
1802     * @param strict a strict object.
1803     * @throws IOException IOException if any.
1804     * @throws XMLStreamException XMLStreamException if any.
1805     * @return Thingy
1806     */
1807    private Thingy parseThingy( XMLStreamReader xmlStreamReader, boolean strict )
1808        throws IOException, XMLStreamException
1809    {
1810        Thingy thingy = new Thingy();
1811        thingy.setSomeContent( getTrimmedValue( xmlStreamReader.getElementText() ) );
1812        return thingy;
1813    } //-- Thingy parseThingy( XMLStreamReader, boolean )
1814
1815    /**
1816     * Method parseXdocFeatures.
1817     * 
1818     * @param xmlStreamReader a xmlStreamReader object.
1819     * @param strict a strict object.
1820     * @throws IOException IOException if any.
1821     * @throws XMLStreamException XMLStreamException if any.
1822     * @return XdocFeatures
1823     */
1824    private XdocFeatures parseXdocFeatures( XMLStreamReader xmlStreamReader, boolean strict )
1825        throws IOException, XMLStreamException
1826    {
1827        XdocFeatures xdocFeatures = new XdocFeatures();
1828        java.util.Set parsed = new java.util.HashSet();
1829        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1830        {
1831            if ( checkFieldWithDuplicate( xmlStreamReader, "field", null, parsed ) )
1832            {
1833                xdocFeatures.setField( getTrimmedValue( xmlStreamReader.getElementText() ) );
1834            }
1835            else if ( checkFieldWithDuplicate( xmlStreamReader, "xdocSeparatorNone", null, parsed ) )
1836            {
1837                xdocFeatures.setXdocSeparatorNone( getTrimmedValue( xmlStreamReader.getElementText() ) );
1838            }
1839            else if ( checkFieldWithDuplicate( xmlStreamReader, "xdocSeparatorBlank", null, parsed ) )
1840            {
1841                xdocFeatures.setXdocSeparatorBlank( getTrimmedValue( xmlStreamReader.getElementText() ) );
1842            }
1843            else
1844            {
1845                checkUnknownElement( xmlStreamReader, strict );
1846            }
1847        }
1848        return xdocFeatures;
1849    } //-- XdocFeatures parseXdocFeatures( XMLStreamReader, boolean )
1850
1851    /**
1852     * Method parseXmlAttributes.
1853     * 
1854     * @param xmlStreamReader a xmlStreamReader object.
1855     * @param strict a strict object.
1856     * @throws IOException IOException if any.
1857     * @throws XMLStreamException XMLStreamException if any.
1858     * @return XmlAttributes
1859     */
1860    private XmlAttributes parseXmlAttributes( XMLStreamReader xmlStreamReader, boolean strict )
1861        throws IOException, XMLStreamException
1862    {
1863        XmlAttributes xmlAttributes = new XmlAttributes();
1864        java.util.Set parsed = new java.util.HashSet();
1865        xmlAttributes.setPrimitiveBoolean( getBooleanValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveBoolean" ), "true" ) ), "primitiveBoolean", xmlStreamReader ) );
1866        xmlAttributes.setPrimitiveChar( getCharacterValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveChar" ), "H" ) ), "primitiveChar", xmlStreamReader ) );
1867        xmlAttributes.setPrimitiveByte( getByteValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveByte" ), "12" ) ), "primitiveByte", xmlStreamReader, strict ) );
1868        xmlAttributes.setPrimitiveShort( getShortValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveShort" ), "1212" ) ), "primitiveShort", xmlStreamReader, strict ) );
1869        xmlAttributes.setPrimitiveInt( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveInt" ), "121212" ) ), "primitiveInt", xmlStreamReader, strict ) );
1870        xmlAttributes.setPrimitiveLong( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveLong" ), "1234567890123" ) ), "primitiveLong", xmlStreamReader, strict ) );
1871        xmlAttributes.setPrimitiveFloat( getFloatValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveFloat" ), "12.12" ) ), "primitiveFloat", xmlStreamReader, strict ) );
1872        xmlAttributes.setPrimitiveDouble( getDoubleValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "primitiveDouble" ), "12.12" ) ), "primitiveDouble", xmlStreamReader, strict ) );
1873        xmlAttributes.setObjectString( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "objectString" ), "default value" ) ) );
1874        String dateFormat = null;
1875        xmlAttributes.setObjectDate( getDateValue( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "objectDate" ) ), "objectDate", dateFormat, xmlStreamReader ) );
1876        xmlAttributes.setAttribute( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "tag-name" ), "default" ) ) );
1877        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1878        {
1879            checkUnknownElement( xmlStreamReader, strict );
1880        }
1881        return xmlAttributes;
1882    } //-- XmlAttributes parseXmlAttributes( XMLStreamReader, boolean )
1883
1884    /**
1885     * Method parseXmlContent.
1886     * 
1887     * @param xmlStreamReader a xmlStreamReader object.
1888     * @param strict a strict object.
1889     * @throws IOException IOException if any.
1890     * @throws XMLStreamException XMLStreamException if any.
1891     * @return XmlContent
1892     */
1893    private XmlContent parseXmlContent( XMLStreamReader xmlStreamReader, boolean strict )
1894        throws IOException, XMLStreamException
1895    {
1896        XmlContent xmlContent = new XmlContent();
1897        java.util.Set parsed = new java.util.HashSet();
1898        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1899        {
1900            if ( checkFieldWithDuplicate( xmlStreamReader, "content.long", null, parsed ) )
1901            {
1902                xmlContent.setLongContent( parseXmlContentLong( xmlStreamReader, strict ) );
1903            }
1904            else if ( checkFieldWithDuplicate( xmlStreamReader, "content.long-with-attributes", null, parsed ) )
1905            {
1906                xmlContent.setLongContentWithAttributes( parseXmlContentLongWithAttributes( xmlStreamReader, strict ) );
1907            }
1908            else
1909            {
1910                checkUnknownElement( xmlStreamReader, strict );
1911            }
1912        }
1913        return xmlContent;
1914    } //-- XmlContent parseXmlContent( XMLStreamReader, boolean )
1915
1916    /**
1917     * Method parseXmlContentLong.
1918     * 
1919     * @param xmlStreamReader a xmlStreamReader object.
1920     * @param strict a strict object.
1921     * @throws IOException IOException if any.
1922     * @throws XMLStreamException XMLStreamException if any.
1923     * @return XmlContentLong
1924     */
1925    private XmlContentLong parseXmlContentLong( XMLStreamReader xmlStreamReader, boolean strict )
1926        throws IOException, XMLStreamException
1927    {
1928        XmlContentLong xmlContentLong = new XmlContentLong();
1929        xmlContentLong.setContent( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "12121212" ) ), "content", xmlStreamReader, strict ) );
1930        return xmlContentLong;
1931    } //-- XmlContentLong parseXmlContentLong( XMLStreamReader, boolean )
1932
1933    /**
1934     * Method parseXmlContentLongWithAttributes.
1935     * 
1936     * @param xmlStreamReader a xmlStreamReader object.
1937     * @param strict a strict object.
1938     * @throws IOException IOException if any.
1939     * @throws XMLStreamException XMLStreamException if any.
1940     * @return XmlContentLongWithAttributes
1941     */
1942    private XmlContentLongWithAttributes parseXmlContentLongWithAttributes( XMLStreamReader xmlStreamReader, boolean strict )
1943        throws IOException, XMLStreamException
1944    {
1945        XmlContentLongWithAttributes xmlContentLongWithAttributes = new XmlContentLongWithAttributes();
1946        xmlContentLongWithAttributes.setAttr( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "attr" ) ) );
1947        xmlContentLongWithAttributes.setAttr2( getIntegerValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getAttributeValue( null, "attr2" ), "0" ) ), "attr2", xmlStreamReader, strict ) );
1948        xmlContentLongWithAttributes.setContent( getLongValue( getTrimmedValue( getDefaultValue( xmlStreamReader.getElementText(), "12121212" ) ), "content", xmlStreamReader, strict ) );
1949        return xmlContentLongWithAttributes;
1950    } //-- XmlContentLongWithAttributes parseXmlContentLongWithAttributes( XMLStreamReader, boolean )
1951
1952    /**
1953     * Method parseXmlFeatures.
1954     * 
1955     * @param xmlStreamReader a xmlStreamReader object.
1956     * @param strict a strict object.
1957     * @throws IOException IOException if any.
1958     * @throws XMLStreamException XMLStreamException if any.
1959     * @return XmlFeatures
1960     */
1961    private XmlFeatures parseXmlFeatures( XMLStreamReader xmlStreamReader, boolean strict )
1962        throws IOException, XMLStreamException
1963    {
1964        XmlFeatures xmlFeatures = new XmlFeatures();
1965        java.util.Set parsed = new java.util.HashSet();
1966        xmlFeatures.setFieldNameAttribute( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "tag-name.attribute" ) ) );
1967        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
1968        {
1969            if ( checkFieldWithDuplicate( xmlStreamReader, "attributes", null, parsed ) )
1970            {
1971                xmlFeatures.setAttributes( parseXmlAttributes( xmlStreamReader, strict ) );
1972            }
1973            else if ( checkFieldWithDuplicate( xmlStreamReader, "attributesDefault", null, parsed ) )
1974            {
1975                xmlFeatures.setAttributesDefault( parseXmlAttributes( xmlStreamReader, strict ) );
1976            }
1977            else if ( checkFieldWithDuplicate( xmlStreamReader, "content", null, parsed ) )
1978            {
1979                xmlFeatures.setContent( parseXmlContent( xmlStreamReader, strict ) );
1980            }
1981            else if ( checkFieldWithDuplicate( xmlStreamReader, "fieldTrim", null, parsed ) )
1982            {
1983                xmlFeatures.setFieldTrim( getTrimmedValue( xmlStreamReader.getElementText() ) );
1984            }
1985            else if ( checkFieldWithDuplicate( xmlStreamReader, "fieldNoTrim", null, parsed ) )
1986            {
1987                xmlFeatures.setFieldNoTrim( xmlStreamReader.getElementText() );
1988            }
1989            else if ( checkFieldWithDuplicate( xmlStreamReader, "dom", null, parsed ) )
1990            {
1991                xmlFeatures.setDom( buildDom( xmlStreamReader, true ) );
1992            }
1993            else if ( checkFieldWithDuplicate( xmlStreamReader, "domNoTrim", null, parsed ) )
1994            {
1995                xmlFeatures.setDomNoTrim( buildDom( xmlStreamReader, false ) );
1996            }
1997            else if ( checkFieldWithDuplicate( xmlStreamReader, "tag-name", null, parsed ) )
1998            {
1999                xmlFeatures.setFieldName( getTrimmedValue( xmlStreamReader.getElementText() ) );
2000            }
2001            else if ( checkFieldWithDuplicate( xmlStreamReader, "dateXmlFormat", null, parsed ) )
2002            {
2003                String dateFormat = "yyyy-MM-dd'T'HH:mm:ss";
2004                xmlFeatures.setDateXmlFormat( getDateValue( getTrimmedValue( xmlStreamReader.getElementText() ), "dateXmlFormat", dateFormat, xmlStreamReader ) );
2005            }
2006            else if ( checkFieldWithDuplicate( xmlStreamReader, "dateLong", null, parsed ) )
2007            {
2008                String dateFormat = "long";
2009                xmlFeatures.setDateLong( getDateValue( getTrimmedValue( xmlStreamReader.getElementText() ), "dateLong", dateFormat, xmlStreamReader ) );
2010            }
2011            else if ( "xmlItemsStyleFlat".equals( xmlStreamReader.getLocalName() ) )
2012            {
2013                java.util.List xmlItemsStyleFlats = xmlFeatures.getXmlItemsStyleFlats();
2014                if ( xmlItemsStyleFlats == null )
2015                {
2016                    xmlItemsStyleFlats = new java.util.ArrayList/*<Reference>*/();
2017                    xmlFeatures.setXmlItemsStyleFlats( xmlItemsStyleFlats );
2018                }
2019                xmlFeatures.addXmlItemsStyleFlat( parseReference( xmlStreamReader, strict ) );
2020            }
2021            else if ( checkFieldWithDuplicate( xmlStreamReader, "xmlAssociationTagNames", null, parsed ) )
2022            {
2023                java.util.List xmlAssociationTagNames = new java.util.ArrayList/*<Reference>*/();
2024                xmlFeatures.setXmlAssociationTagNames( xmlAssociationTagNames );
2025                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
2026                {
2027                    if ( "association.tag-name".equals( xmlStreamReader.getLocalName() ) )
2028                    {
2029                        xmlFeatures.addXmlAssociationTagName( parseReference( xmlStreamReader, strict ) );
2030                    }
2031                    else
2032                    {
2033                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
2034                    }
2035                }
2036            }
2037            else if ( checkFieldWithDuplicate( xmlStreamReader, "field.tag-names", null, parsed ) )
2038            {
2039                java.util.List xmlTagNameAssociation = new java.util.ArrayList/*<Reference>*/();
2040                xmlFeatures.setXmlTagNameAssociation( xmlTagNameAssociation );
2041                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
2042                {
2043                    if ( "field.tag-name".equals( xmlStreamReader.getLocalName() ) )
2044                    {
2045                        xmlFeatures.addXmlTagNameAssociation( parseReference( xmlStreamReader, strict ) );
2046                    }
2047                    else
2048                    {
2049                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
2050                    }
2051                }
2052            }
2053            else if ( checkFieldWithDuplicate( xmlStreamReader, "field.tag-name", null, parsed ) )
2054            {
2055                java.util.List xmlTagNameAssociationTagNames = new java.util.ArrayList/*<Reference>*/();
2056                xmlFeatures.setXmlTagNameAssociationTagNames( xmlTagNameAssociationTagNames );
2057                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
2058                {
2059                    if ( "association.tag-name".equals( xmlStreamReader.getLocalName() ) )
2060                    {
2061                        xmlFeatures.addXmlTagNameAssociationTagName( parseReference( xmlStreamReader, strict ) );
2062                    }
2063                    else
2064                    {
2065                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
2066                    }
2067                }
2068            }
2069            else if ( "association.tag-name".equals( xmlStreamReader.getLocalName() ) )
2070            {
2071                java.util.List xmlFlatAssociationTagNames = xmlFeatures.getXmlFlatAssociationTagNames();
2072                if ( xmlFlatAssociationTagNames == null )
2073                {
2074                    xmlFlatAssociationTagNames = new java.util.ArrayList/*<Reference>*/();
2075                    xmlFeatures.setXmlFlatAssociationTagNames( xmlFlatAssociationTagNames );
2076                }
2077                xmlFeatures.addXmlFlatAssociationTagName( parseReference( xmlStreamReader, strict ) );
2078            }
2079            else if ( checkFieldWithDuplicate( xmlStreamReader, "explodeProperties", null, parsed ) )
2080            {
2081                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
2082                {
2083                    if ( "explodeProperty".equals( xmlStreamReader.getLocalName() ) )
2084                    {
2085                        String key = null;
2086                        String value = null;
2087                        // explode mode.
2088                        while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
2089                        {
2090                            if ( "key".equals( xmlStreamReader.getLocalName() ) )
2091                            {
2092                                key = xmlStreamReader.getElementText();
2093                            }
2094                            else if ( "value".equals( xmlStreamReader.getLocalName() ) )
2095                            {
2096                                value = xmlStreamReader.getElementText().trim();
2097                            }
2098                            else
2099                            {
2100                                xmlStreamReader.getText();
2101                            }
2102                        }
2103                        xmlFeatures.addExplodeProperty( key, value );
2104                    }
2105                    xmlStreamReader.next();
2106                }
2107            }
2108            else if ( checkFieldWithDuplicate( xmlStreamReader, "inlineProperties", null, parsed ) )
2109            {
2110                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
2111                {
2112                    String key = xmlStreamReader.getLocalName();
2113                    String value = xmlStreamReader.getElementText().trim();
2114                    xmlFeatures.addInlineProperty( key, value );
2115                }
2116            }
2117            else if ( checkFieldWithDuplicate( xmlStreamReader, "xmlTransientFields", null, parsed ) )
2118            {
2119                xmlFeatures.setXmlTransientFields( parseXmlTransientFields( xmlStreamReader, strict ) );
2120            }
2121            else if ( checkFieldWithDuplicate( xmlStreamReader, "xmlFieldsOrder", null, parsed ) )
2122            {
2123                xmlFeatures.setXmlFieldsOrder( parseXmlFieldsOrder( xmlStreamReader, strict ) );
2124            }
2125            else if ( checkFieldWithDuplicate( xmlStreamReader, "xsdFeatures", null, parsed ) )
2126            {
2127                xmlFeatures.setXsdFeatures( parseXsdFeatures( xmlStreamReader, strict ) );
2128            }
2129            else
2130            {
2131                checkUnknownElement( xmlStreamReader, strict );
2132            }
2133        }
2134        return xmlFeatures;
2135    } //-- XmlFeatures parseXmlFeatures( XMLStreamReader, boolean )
2136
2137    /**
2138     * Method parseXmlFieldsOrder.
2139     * 
2140     * @param xmlStreamReader a xmlStreamReader object.
2141     * @param strict a strict object.
2142     * @throws IOException IOException if any.
2143     * @throws XMLStreamException XMLStreamException if any.
2144     * @return XmlFieldsOrder
2145     */
2146    private XmlFieldsOrder parseXmlFieldsOrder( XMLStreamReader xmlStreamReader, boolean strict )
2147        throws IOException, XMLStreamException
2148    {
2149        XmlFieldsOrder xmlFieldsOrder = new XmlFieldsOrder();
2150        java.util.Set parsed = new java.util.HashSet();
2151        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
2152        {
2153            if ( checkFieldWithDuplicate( xmlStreamReader, "field1", null, parsed ) )
2154            {
2155                xmlFieldsOrder.setField1( getTrimmedValue( xmlStreamReader.getElementText() ) );
2156            }
2157            else if ( checkFieldWithDuplicate( xmlStreamReader, "field3", null, parsed ) )
2158            {
2159                xmlFieldsOrder.setField3( getTrimmedValue( xmlStreamReader.getElementText() ) );
2160            }
2161            else if ( checkFieldWithDuplicate( xmlStreamReader, "field6", null, parsed ) )
2162            {
2163                xmlFieldsOrder.setField6( getTrimmedValue( xmlStreamReader.getElementText() ) );
2164            }
2165            else if ( checkFieldWithDuplicate( xmlStreamReader, "field4", null, parsed ) )
2166            {
2167                xmlFieldsOrder.setField4( getTrimmedValue( xmlStreamReader.getElementText() ) );
2168            }
2169            else if ( checkFieldWithDuplicate( xmlStreamReader, "field5", null, parsed ) )
2170            {
2171                xmlFieldsOrder.setField5( getTrimmedValue( xmlStreamReader.getElementText() ) );
2172            }
2173            else if ( checkFieldWithDuplicate( xmlStreamReader, "field7", null, parsed ) )
2174            {
2175                xmlFieldsOrder.setField7( getTrimmedValue( xmlStreamReader.getElementText() ) );
2176            }
2177            else if ( checkFieldWithDuplicate( xmlStreamReader, "field-2", null, parsed ) )
2178            {
2179                xmlFieldsOrder.setField( getTrimmedValue( xmlStreamReader.getElementText() ) );
2180            }
2181            else
2182            {
2183                checkUnknownElement( xmlStreamReader, strict );
2184            }
2185        }
2186        return xmlFieldsOrder;
2187    } //-- XmlFieldsOrder parseXmlFieldsOrder( XMLStreamReader, boolean )
2188
2189    /**
2190     * Method parseXmlFieldsOrderParent.
2191     * 
2192     * @param xmlStreamReader a xmlStreamReader object.
2193     * @param strict a strict object.
2194     * @throws IOException IOException if any.
2195     * @throws XMLStreamException XMLStreamException if any.
2196     * @return XmlFieldsOrderParent
2197     */
2198    private XmlFieldsOrderParent parseXmlFieldsOrderParent( XMLStreamReader xmlStreamReader, boolean strict )
2199        throws IOException, XMLStreamException
2200    {
2201        XmlFieldsOrderParent xmlFieldsOrderParent = new XmlFieldsOrderParent();
2202        java.util.Set parsed = new java.util.HashSet();
2203        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
2204        {
2205            if ( checkFieldWithDuplicate( xmlStreamReader, "field4", null, parsed ) )
2206            {
2207                xmlFieldsOrderParent.setField4( getTrimmedValue( xmlStreamReader.getElementText() ) );
2208            }
2209            else if ( checkFieldWithDuplicate( xmlStreamReader, "field5", null, parsed ) )
2210            {
2211                xmlFieldsOrderParent.setField5( getTrimmedValue( xmlStreamReader.getElementText() ) );
2212            }
2213            else if ( checkFieldWithDuplicate( xmlStreamReader, "field7", null, parsed ) )
2214            {
2215                xmlFieldsOrderParent.setField7( getTrimmedValue( xmlStreamReader.getElementText() ) );
2216            }
2217            else if ( checkFieldWithDuplicate( xmlStreamReader, "field-2", null, parsed ) )
2218            {
2219                xmlFieldsOrderParent.setField( getTrimmedValue( xmlStreamReader.getElementText() ) );
2220            }
2221            else
2222            {
2223                checkUnknownElement( xmlStreamReader, strict );
2224            }
2225        }
2226        return xmlFieldsOrderParent;
2227    } //-- XmlFieldsOrderParent parseXmlFieldsOrderParent( XMLStreamReader, boolean )
2228
2229    /**
2230     * Method parseXmlFieldsOrderParent2.
2231     * 
2232     * @param xmlStreamReader a xmlStreamReader object.
2233     * @param strict a strict object.
2234     * @throws IOException IOException if any.
2235     * @throws XMLStreamException XMLStreamException if any.
2236     * @return XmlFieldsOrderParent2
2237     */
2238    private XmlFieldsOrderParent2 parseXmlFieldsOrderParent2( XMLStreamReader xmlStreamReader, boolean strict )
2239        throws IOException, XMLStreamException
2240    {
2241        XmlFieldsOrderParent2 xmlFieldsOrderParent2 = new XmlFieldsOrderParent2();
2242        java.util.Set parsed = new java.util.HashSet();
2243        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
2244        {
2245            if ( checkFieldWithDuplicate( xmlStreamReader, "field-2", null, parsed ) )
2246            {
2247                xmlFieldsOrderParent2.setField( getTrimmedValue( xmlStreamReader.getElementText() ) );
2248            }
2249            else
2250            {
2251                checkUnknownElement( xmlStreamReader, strict );
2252            }
2253        }
2254        return xmlFieldsOrderParent2;
2255    } //-- XmlFieldsOrderParent2 parseXmlFieldsOrderParent2( XMLStreamReader, boolean )
2256
2257    /**
2258     * Method parseXmlTransientFields.
2259     * 
2260     * @param xmlStreamReader a xmlStreamReader object.
2261     * @param strict a strict object.
2262     * @throws IOException IOException if any.
2263     * @throws XMLStreamException XMLStreamException if any.
2264     * @return XmlTransientFields
2265     */
2266    private XmlTransientFields parseXmlTransientFields( XMLStreamReader xmlStreamReader, boolean strict )
2267        throws IOException, XMLStreamException
2268    {
2269        XmlTransientFields xmlTransientFields = new XmlTransientFields();
2270        java.util.Set parsed = new java.util.HashSet();
2271        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
2272        {
2273            if ( checkFieldWithDuplicate( xmlStreamReader, "persistentField", null, parsed ) )
2274            {
2275                xmlTransientFields.setPersistentField( getTrimmedValue( xmlStreamReader.getElementText() ) );
2276            }
2277            else
2278            {
2279                checkUnknownElement( xmlStreamReader, strict );
2280            }
2281        }
2282        return xmlTransientFields;
2283    } //-- XmlTransientFields parseXmlTransientFields( XMLStreamReader, boolean )
2284
2285    /**
2286     * Method parseXsdFeatures.
2287     * 
2288     * @param xmlStreamReader a xmlStreamReader object.
2289     * @param strict a strict object.
2290     * @throws IOException IOException if any.
2291     * @throws XMLStreamException XMLStreamException if any.
2292     * @return XsdFeatures
2293     */
2294    private XsdFeatures parseXsdFeatures( XMLStreamReader xmlStreamReader, boolean strict )
2295        throws IOException, XMLStreamException
2296    {
2297        XsdFeatures xsdFeatures = new XsdFeatures();
2298        java.util.Set parsed = new java.util.HashSet();
2299        xsdFeatures.setAttribute( getTrimmedValue( xmlStreamReader.getAttributeValue( null, "attribute" ) ) );
2300        while ( ( strict ? xmlStreamReader.nextTag() : nextTag( xmlStreamReader ) ) == XMLStreamConstants.START_ELEMENT )
2301        {
2302            checkUnknownElement( xmlStreamReader, strict );
2303        }
2304        return xsdFeatures;
2305    } //-- XsdFeatures parseXsdFeatures( XMLStreamReader, boolean )
2306
2307    /**
2308     * Method read.
2309     * 
2310     * @param xmlStreamReader a xmlStreamReader object.
2311     * @param strict a strict object.
2312     * @throws IOException IOException if any.
2313     * @throws XMLStreamException XMLStreamException if any.
2314     * @return Features
2315     */
2316    private Features read( XMLStreamReader xmlStreamReader, boolean strict )
2317        throws IOException, XMLStreamException
2318    {
2319        int eventType = xmlStreamReader.getEventType();
2320        String encoding = null;
2321        while ( eventType != XMLStreamConstants.END_DOCUMENT )
2322        {
2323            if ( eventType == XMLStreamConstants.START_DOCUMENT )
2324            {
2325                encoding = xmlStreamReader.getCharacterEncodingScheme();
2326            }
2327            if ( eventType == XMLStreamConstants.START_ELEMENT )
2328            {
2329                if ( strict && ! "features-demo".equals( xmlStreamReader.getLocalName() ) )
2330                {
2331                    throw new XMLStreamException( "Expected root element 'features-demo' but found '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation(), null );
2332                }
2333                Features features = parseFeatures( xmlStreamReader, strict );
2334                features.setModelEncoding( encoding );
2335                resolveReferences( features );
2336                return features;
2337            }
2338            eventType = xmlStreamReader.next();
2339        }
2340        throw new XMLStreamException( "Expected root element 'features-demo' but found no element at all: invalid XML document", xmlStreamReader.getLocation(), null );
2341    } //-- Features read( XMLStreamReader, boolean )
2342
2343    /**
2344     * Method resolveReferences.
2345     * 
2346     * @param value a value object.
2347     */
2348    private void resolveReferences( Features value )
2349    {
2350        java.util.Map refs;
2351    } //-- void resolveReferences( Features )
2352
2353}