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