001/*
002 =================== DO NOT EDIT THIS FILE ====================
003 Generated by Modello 1.9.2-SNAPSHOT,
004 any modifications will be overwritten.
005 ==============================================================
006 */
007
008package org.codehaus.modello.test.features.io.xpp3;
009
010  //---------------------------------/
011 //- Imported classes and packages -/
012//---------------------------------/
013
014import java.io.OutputStream;
015import java.io.Writer;
016import java.util.Iterator;
017import org.codehaus.modello.test.features.Action;
018import org.codehaus.modello.test.features.AnnotationTest;
019import org.codehaus.modello.test.features.ArrayFeatures;
020import org.codehaus.modello.test.features.AssociationFeatures;
021import org.codehaus.modello.test.features.BaseClass;
022import org.codehaus.modello.test.features.BidiInList;
023import org.codehaus.modello.test.features.BidiInSet;
024import org.codehaus.modello.test.features.Bidirectional;
025import org.codehaus.modello.test.features.ContentTest;
026import org.codehaus.modello.test.features.DueTo;
027import org.codehaus.modello.test.features.Features;
028import org.codehaus.modello.test.features.File;
029import org.codehaus.modello.test.features.InterfacesFeature;
030import org.codehaus.modello.test.features.JavaFeatures;
031import org.codehaus.modello.test.features.NodeItem;
032import org.codehaus.modello.test.features.Reference;
033import org.codehaus.modello.test.features.SimpleInterface;
034import org.codehaus.modello.test.features.SimpleTypes;
035import org.codehaus.modello.test.features.SubClassLevel1;
036import org.codehaus.modello.test.features.SubClassLevel2;
037import org.codehaus.modello.test.features.SubClassLevel3;
038import org.codehaus.modello.test.features.SubInterface;
039import org.codehaus.modello.test.features.SuperThing;
040import org.codehaus.modello.test.features.Thing;
041import org.codehaus.modello.test.features.Thingy;
042import org.codehaus.modello.test.features.XdocFeatures;
043import org.codehaus.modello.test.features.XmlAttributes;
044import org.codehaus.modello.test.features.XmlContent;
045import org.codehaus.modello.test.features.XmlContentLong;
046import org.codehaus.modello.test.features.XmlContentLongWithAttributes;
047import org.codehaus.modello.test.features.XmlFeatures;
048import org.codehaus.modello.test.features.XmlFieldsOrder;
049import org.codehaus.modello.test.features.XmlFieldsOrderParent;
050import org.codehaus.modello.test.features.XmlFieldsOrderParent2;
051import org.codehaus.modello.test.features.XmlTransientFields;
052import org.codehaus.modello.test.features.XsdFeatures;
053import org.codehaus.modello.test.features.other.PackageNameFeature;
054import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
055import org.codehaus.plexus.util.xml.Xpp3Dom;
056import org.codehaus.plexus.util.xml.pull.MXSerializer;
057import org.codehaus.plexus.util.xml.pull.XmlSerializer;
058
059/**
060 * Class ModelloFeaturesTestXpp3Writer.
061 * 
062 * @version $Revision$ $Date$
063 */
064@SuppressWarnings( "all" )
065public class ModelloFeaturesTestXpp3Writer
066{
067
068      //--------------------------/
069     //- Class/Member Variables -/
070    //--------------------------/
071
072    /**
073     * Field NAMESPACE.
074     */
075    private static final String NAMESPACE = null;
076
077    /**
078     * Field fileComment.
079     */
080    private String fileComment = null;
081
082
083      //-----------/
084     //- Methods -/
085    //-----------/
086
087    /**
088     * Method setFileComment.
089     * 
090     * @param fileComment
091     */
092    public void setFileComment( String fileComment )
093    {
094        this.fileComment = fileComment;
095    } //-- void setFileComment( String )
096
097    /**
098     * Method write.
099     * 
100     * @param writer
101     * @param features
102     * @throws java.io.IOException
103     */
104    public void write( Writer writer, Features features )
105        throws java.io.IOException
106    {
107        XmlSerializer serializer = new MXSerializer();
108        serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
109        serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
110        serializer.setOutput( writer );
111        serializer.startDocument( features.getModelEncoding(), null );
112        writeFeatures( features, "features-demo", serializer );
113        serializer.endDocument();
114    } //-- void write( Writer, Features )
115
116    /**
117     * Method write.
118     * 
119     * @param stream
120     * @param features
121     * @throws java.io.IOException
122     */
123    public void write( OutputStream stream, Features features )
124        throws java.io.IOException
125    {
126        XmlSerializer serializer = new MXSerializer();
127        serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
128        serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
129        serializer.setOutput( stream, features.getModelEncoding() );
130        serializer.startDocument( features.getModelEncoding(), null );
131        writeFeatures( features, "features-demo", serializer );
132        serializer.endDocument();
133    } //-- void write( OutputStream, Features )
134
135    /**
136     * Method writeAction.
137     * 
138     * @param action
139     * @param serializer
140     * @param tagName
141     * @throws java.io.IOException
142     */
143    private void writeAction( Action action, String tagName, XmlSerializer serializer )
144        throws java.io.IOException
145    {
146        serializer.startTag( NAMESPACE, tagName );
147        if ( action.getDev() != null )
148        {
149            serializer.attribute( NAMESPACE, "dev", action.getDev() );
150        }
151        serializer.text( action.getAction() );
152        serializer.endTag( NAMESPACE, tagName );
153    } //-- void writeAction( Action, String, XmlSerializer )
154
155    /**
156     * Method writeAnnotationTest.
157     * 
158     * @param annotationTest
159     * @param serializer
160     * @param tagName
161     * @throws java.io.IOException
162     */
163    private void writeAnnotationTest( AnnotationTest annotationTest, String tagName, XmlSerializer serializer )
164        throws java.io.IOException
165    {
166        serializer.startTag( NAMESPACE, tagName );
167        if ( annotationTest.getAnyField() != null )
168        {
169            serializer.startTag( NAMESPACE, "anyField" ).text( annotationTest.getAnyField() ).endTag( NAMESPACE, "anyField" );
170        }
171        serializer.endTag( NAMESPACE, tagName );
172    } //-- void writeAnnotationTest( AnnotationTest, String, XmlSerializer )
173
174    /**
175     * Method writeArrayFeatures.
176     * 
177     * @param arrayFeatures
178     * @param serializer
179     * @param tagName
180     * @throws java.io.IOException
181     */
182    private void writeArrayFeatures( ArrayFeatures arrayFeatures, String tagName, XmlSerializer serializer )
183        throws java.io.IOException
184    {
185        serializer.startTag( NAMESPACE, tagName );
186        serializer.endTag( NAMESPACE, tagName );
187    } //-- void writeArrayFeatures( ArrayFeatures, String, XmlSerializer )
188
189    /**
190     * Method writeAssociationFeatures.
191     * 
192     * @param associationFeatures
193     * @param serializer
194     * @param tagName
195     * @throws java.io.IOException
196     */
197    private void writeAssociationFeatures( AssociationFeatures associationFeatures, String tagName, XmlSerializer serializer )
198        throws java.io.IOException
199    {
200        serializer.startTag( NAMESPACE, tagName );
201        if ( ( associationFeatures.getListReferences() != null ) && ( associationFeatures.getListReferences().size() > 0 ) )
202        {
203            serializer.startTag( NAMESPACE, "listReferences" );
204            for ( Iterator iter = associationFeatures.getListReferences().iterator(); iter.hasNext(); )
205            {
206                Reference o = (Reference) iter.next();
207                writeReference( o, "listReference", serializer );
208            }
209            serializer.endTag( NAMESPACE, "listReferences" );
210        }
211        if ( ( associationFeatures.getSetReferences() != null ) && ( associationFeatures.getSetReferences().size() > 0 ) )
212        {
213            serializer.startTag( NAMESPACE, "setReferences" );
214            for ( Iterator iter = associationFeatures.getSetReferences().iterator(); iter.hasNext(); )
215            {
216                Reference o = (Reference) iter.next();
217                writeReference( o, "setReference", serializer );
218            }
219            serializer.endTag( NAMESPACE, "setReferences" );
220        }
221        if ( ( associationFeatures.getListStrings() != null ) && ( associationFeatures.getListStrings().size() > 0 ) )
222        {
223            serializer.startTag( NAMESPACE, "listStrings" );
224            for ( Iterator iter = associationFeatures.getListStrings().iterator(); iter.hasNext(); )
225            {
226                String listString = (String) iter.next();
227                serializer.startTag( NAMESPACE, "listString" ).text( listString ).endTag( NAMESPACE, "listString" );
228            }
229            serializer.endTag( NAMESPACE, "listStrings" );
230        }
231        if ( ( associationFeatures.getSetStrings() != null ) && ( associationFeatures.getSetStrings().size() > 0 ) )
232        {
233            serializer.startTag( NAMESPACE, "setStrings" );
234            for ( Iterator iter = associationFeatures.getSetStrings().iterator(); iter.hasNext(); )
235            {
236                String setString = (String) iter.next();
237                serializer.startTag( NAMESPACE, "setString" ).text( setString ).endTag( NAMESPACE, "setString" );
238            }
239            serializer.endTag( NAMESPACE, "setStrings" );
240        }
241        if ( ( associationFeatures.getProperties() != null ) && ( associationFeatures.getProperties().size() > 0 ) )
242        {
243            serializer.startTag( NAMESPACE, "properties" );
244            for ( Iterator iter = associationFeatures.getProperties().keySet().iterator(); iter.hasNext(); )
245            {
246                String key = (String) iter.next();
247                String value = (String) associationFeatures.getProperties().get( key );
248                serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" );
249            }
250            serializer.endTag( NAMESPACE, "properties" );
251        }
252        if ( associationFeatures.getBidi() != null )
253        {
254            writeBidirectional( (Bidirectional) associationFeatures.getBidi(), "bidi", serializer );
255        }
256        if ( ( associationFeatures.getListOfBidis() != null ) && ( associationFeatures.getListOfBidis().size() > 0 ) )
257        {
258            serializer.startTag( NAMESPACE, "listOfBidis" );
259            for ( Iterator iter = associationFeatures.getListOfBidis().iterator(); iter.hasNext(); )
260            {
261                BidiInList o = (BidiInList) iter.next();
262                writeBidiInList( o, "listOfBidi", serializer );
263            }
264            serializer.endTag( NAMESPACE, "listOfBidis" );
265        }
266        if ( ( associationFeatures.getSetOfBidis() != null ) && ( associationFeatures.getSetOfBidis().size() > 0 ) )
267        {
268            serializer.startTag( NAMESPACE, "setOfBidis" );
269            for ( Iterator iter = associationFeatures.getSetOfBidis().iterator(); iter.hasNext(); )
270            {
271                BidiInSet o = (BidiInSet) iter.next();
272                writeBidiInSet( o, "setOfBidi", serializer );
273            }
274            serializer.endTag( NAMESPACE, "setOfBidis" );
275        }
276        serializer.endTag( NAMESPACE, tagName );
277    } //-- void writeAssociationFeatures( AssociationFeatures, String, XmlSerializer )
278
279    /**
280     * Method writeBaseClass.
281     * 
282     * @param baseClass
283     * @param serializer
284     * @param tagName
285     * @throws java.io.IOException
286     */
287    private void writeBaseClass( BaseClass baseClass, String tagName, XmlSerializer serializer )
288        throws java.io.IOException
289    {
290        serializer.startTag( NAMESPACE, tagName );
291        if ( baseClass.getBaseAttribute() != 0 )
292        {
293            serializer.attribute( NAMESPACE, "baseAttribute", String.valueOf( baseClass.getBaseAttribute() ) );
294        }
295        if ( baseClass.getBaseElement() != 0 )
296        {
297            serializer.startTag( NAMESPACE, "baseElement" ).text( String.valueOf( baseClass.getBaseElement() ) ).endTag( NAMESPACE, "baseElement" );
298        }
299        serializer.endTag( NAMESPACE, tagName );
300    } //-- void writeBaseClass( BaseClass, String, XmlSerializer )
301
302    /**
303     * Method writeBidiInList.
304     * 
305     * @param bidiInList
306     * @param serializer
307     * @param tagName
308     * @throws java.io.IOException
309     */
310    private void writeBidiInList( BidiInList bidiInList, String tagName, XmlSerializer serializer )
311        throws java.io.IOException
312    {
313        serializer.startTag( NAMESPACE, tagName );
314        if ( bidiInList.getParent() != null )
315        {
316            writeAssociationFeatures( (AssociationFeatures) bidiInList.getParent(), "parent", serializer );
317        }
318        serializer.endTag( NAMESPACE, tagName );
319    } //-- void writeBidiInList( BidiInList, String, XmlSerializer )
320
321    /**
322     * Method writeBidiInSet.
323     * 
324     * @param bidiInSet
325     * @param serializer
326     * @param tagName
327     * @throws java.io.IOException
328     */
329    private void writeBidiInSet( BidiInSet bidiInSet, String tagName, XmlSerializer serializer )
330        throws java.io.IOException
331    {
332        serializer.startTag( NAMESPACE, tagName );
333        if ( bidiInSet.getParent() != null )
334        {
335            writeAssociationFeatures( (AssociationFeatures) bidiInSet.getParent(), "parent", serializer );
336        }
337        serializer.endTag( NAMESPACE, tagName );
338    } //-- void writeBidiInSet( BidiInSet, String, XmlSerializer )
339
340    /**
341     * Method writeBidirectional.
342     * 
343     * @param bidirectional
344     * @param serializer
345     * @param tagName
346     * @throws java.io.IOException
347     */
348    private void writeBidirectional( Bidirectional bidirectional, String tagName, XmlSerializer serializer )
349        throws java.io.IOException
350    {
351        serializer.startTag( NAMESPACE, tagName );
352        if ( bidirectional.getParent() != null )
353        {
354            writeAssociationFeatures( (AssociationFeatures) bidirectional.getParent(), "parent", serializer );
355        }
356        serializer.endTag( NAMESPACE, tagName );
357    } //-- void writeBidirectional( Bidirectional, String, XmlSerializer )
358
359    /**
360     * Method writeContentTest.
361     * 
362     * @param contentTest
363     * @param serializer
364     * @param tagName
365     * @throws java.io.IOException
366     */
367    private void writeContentTest( ContentTest contentTest, String tagName, XmlSerializer serializer )
368        throws java.io.IOException
369    {
370        serializer.startTag( NAMESPACE, tagName );
371        if ( contentTest.getAttr() != null )
372        {
373            serializer.attribute( NAMESPACE, "attr", contentTest.getAttr() );
374        }
375        if ( contentTest.getAttr2() != 0 )
376        {
377            serializer.attribute( NAMESPACE, "attr2", String.valueOf( contentTest.getAttr2() ) );
378        }
379        serializer.text( contentTest.getContent() );
380        serializer.endTag( NAMESPACE, tagName );
381    } //-- void writeContentTest( ContentTest, String, XmlSerializer )
382
383    /**
384     * Method writeDueTo.
385     * 
386     * @param dueTo
387     * @param serializer
388     * @param tagName
389     * @throws java.io.IOException
390     */
391    private void writeDueTo( DueTo dueTo, String tagName, XmlSerializer serializer )
392        throws java.io.IOException
393    {
394        serializer.startTag( NAMESPACE, tagName );
395        if ( dueTo.getName() != null )
396        {
397            serializer.attribute( NAMESPACE, "name", dueTo.getName() );
398        }
399        if ( dueTo.getEmail() != null )
400        {
401            serializer.attribute( NAMESPACE, "email", dueTo.getEmail() );
402        }
403        serializer.endTag( NAMESPACE, tagName );
404    } //-- void writeDueTo( DueTo, String, XmlSerializer )
405
406    /**
407     * Method writeFeatures.
408     * 
409     * @param features
410     * @param serializer
411     * @param tagName
412     * @throws java.io.IOException
413     */
414    private void writeFeatures( Features features, String tagName, XmlSerializer serializer )
415        throws java.io.IOException
416    {
417        if ( this.fileComment != null )
418        {
419        serializer.comment(this.fileComment);
420        }
421        serializer.setPrefix( "", "http://codehaus-plexus.github.io/FEATURES/1.0.0" );
422        serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
423        serializer.startTag( NAMESPACE, tagName );
424        serializer.attribute( "", "xsi:schemaLocation", "http://codehaus-plexus.github.io/FEATURES/1.0.0 http://codehaus-plexus.github.io/features-1.0.0.xsd" );
425        if ( features.getVersionField() != null )
426        {
427            serializer.startTag( NAMESPACE, "versionField" ).text( features.getVersionField() ).endTag( NAMESPACE, "versionField" );
428        }
429        if ( features.getComment() != null )
430        {
431            serializer.startTag( NAMESPACE, "comment" ).text( features.getComment() ).endTag( NAMESPACE, "comment" );
432        }
433        if ( features.getDescription() != null )
434        {
435            serializer.startTag( NAMESPACE, "description" ).text( features.getDescription() ).endTag( NAMESPACE, "description" );
436        }
437        if ( features.getRequired() != null )
438        {
439            serializer.startTag( NAMESPACE, "required" ).text( features.getRequired() ).endTag( NAMESPACE, "required" );
440        }
441        if ( features.getIdentifier() != null )
442        {
443            serializer.startTag( NAMESPACE, "identifier" ).text( features.getIdentifier() ).endTag( NAMESPACE, "identifier" );
444        }
445        if ( features.getIdentifierPart2() != null )
446        {
447            writeReference( (Reference) features.getIdentifierPart2(), "identifierPart2", serializer );
448        }
449        if ( features.getSimpleTypes() != null )
450        {
451            writeSimpleTypes( (SimpleTypes) features.getSimpleTypes(), "simpleTypes", serializer );
452        }
453        if ( features.getDefaultValues() != null )
454        {
455            writeSimpleTypes( (SimpleTypes) features.getDefaultValues(), "defaultValues", serializer );
456        }
457        if ( features.getArrays() != null )
458        {
459            writeArrayFeatures( (ArrayFeatures) features.getArrays(), "arrays", serializer );
460        }
461        if ( features.getAssociationFeatures() != null )
462        {
463            writeAssociationFeatures( (AssociationFeatures) features.getAssociationFeatures(), "associationFeatures", serializer );
464        }
465        if ( features.getJavaFeatures() != null )
466        {
467            writeJavaFeatures( (JavaFeatures) features.getJavaFeatures(), "javaFeatures", serializer );
468        }
469        if ( features.getXmlFeatures() != null )
470        {
471            writeXmlFeatures( (XmlFeatures) features.getXmlFeatures(), "xmlFeatures", serializer );
472        }
473        if ( features.getXdocFeatures() != null )
474        {
475            writeXdocFeatures( (XdocFeatures) features.getXdocFeatures(), "xdocFeatures", serializer );
476        }
477        if ( features.getNode() != null )
478        {
479            writeNodeItem( (NodeItem) features.getNode(), "node", serializer );
480        }
481        if ( features.getCloneable() != null )
482        {
483            writeThing( (Thing) features.getCloneable(), "cloneable", serializer );
484        }
485        if ( features.getFile() != null )
486        {
487            writeFile( (File) features.getFile(), "file", serializer );
488        }
489        if ( features.getAction() != null )
490        {
491            writeAction( (Action) features.getAction(), "action", serializer );
492        }
493        serializer.endTag( NAMESPACE, tagName );
494    } //-- void writeFeatures( Features, String, XmlSerializer )
495
496    /**
497     * Method writeFile.
498     * 
499     * @param file
500     * @param serializer
501     * @param tagName
502     * @throws java.io.IOException
503     */
504    private void writeFile( File file, String tagName, XmlSerializer serializer )
505        throws java.io.IOException
506    {
507        serializer.startTag( NAMESPACE, tagName );
508        if ( file.getFile() != null )
509        {
510            serializer.startTag( NAMESPACE, "file" ).text( file.getFile() ).endTag( NAMESPACE, "file" );
511        }
512        serializer.endTag( NAMESPACE, tagName );
513    } //-- void writeFile( File, String, XmlSerializer )
514
515    /**
516     * Method writeInterfacesFeature.
517     * 
518     * @param interfacesFeature
519     * @param serializer
520     * @param tagName
521     * @throws java.io.IOException
522     */
523    private void writeInterfacesFeature( InterfacesFeature interfacesFeature, String tagName, XmlSerializer serializer )
524        throws java.io.IOException
525    {
526        serializer.startTag( NAMESPACE, tagName );
527        if ( interfacesFeature.getId() != null )
528        {
529            serializer.startTag( NAMESPACE, "id" ).text( interfacesFeature.getId() ).endTag( NAMESPACE, "id" );
530        }
531        serializer.endTag( NAMESPACE, tagName );
532    } //-- void writeInterfacesFeature( InterfacesFeature, String, XmlSerializer )
533
534    /**
535     * Method writeJavaFeatures.
536     * 
537     * @param javaFeatures
538     * @param serializer
539     * @param tagName
540     * @throws java.io.IOException
541     */
542    private void writeJavaFeatures( JavaFeatures javaFeatures, String tagName, XmlSerializer serializer )
543        throws java.io.IOException
544    {
545        serializer.startTag( NAMESPACE, tagName );
546        if ( javaFeatures.getInterfaces() != null )
547        {
548            writeInterfacesFeature( (InterfacesFeature) javaFeatures.getInterfaces(), "interfaces", serializer );
549        }
550        if ( javaFeatures.getPackageName() != null )
551        {
552            writePackageNameFeature( (PackageNameFeature) javaFeatures.getPackageName(), "packageName", serializer );
553        }
554        if ( javaFeatures.getBase() != null )
555        {
556            writeBaseClass( (BaseClass) javaFeatures.getBase(), "base", serializer );
557        }
558        if ( javaFeatures.getSubClass() != null )
559        {
560            writeSubClassLevel1( (SubClassLevel1) javaFeatures.getSubClass(), "subClass", serializer );
561        }
562        if ( javaFeatures.getSubClass2() != null )
563        {
564            writeSubClassLevel2( (SubClassLevel2) javaFeatures.getSubClass2(), "subClass2", serializer );
565        }
566        if ( javaFeatures.getSubClass3() != null )
567        {
568            writeSubClassLevel3( (SubClassLevel3) javaFeatures.getSubClass3(), "subClass3", serializer );
569        }
570        if ( javaFeatures.getAnnotation() != null )
571        {
572            writeAnnotationTest( (AnnotationTest) javaFeatures.getAnnotation(), "annotation", serializer );
573        }
574        serializer.endTag( NAMESPACE, tagName );
575    } //-- void writeJavaFeatures( JavaFeatures, String, XmlSerializer )
576
577    /**
578     * Method writeNodeItem.
579     * 
580     * @param nodeItem
581     * @param serializer
582     * @param tagName
583     * @throws java.io.IOException
584     */
585    private void writeNodeItem( NodeItem nodeItem, String tagName, XmlSerializer serializer )
586        throws java.io.IOException
587    {
588        serializer.startTag( NAMESPACE, tagName );
589        if ( nodeItem.getValue() != null )
590        {
591            serializer.startTag( NAMESPACE, "value" ).text( nodeItem.getValue() ).endTag( NAMESPACE, "value" );
592        }
593        if ( nodeItem.getChild() != null )
594        {
595            writeNodeItem( (NodeItem) nodeItem.getChild(), "child", serializer );
596        }
597        serializer.endTag( NAMESPACE, tagName );
598    } //-- void writeNodeItem( NodeItem, String, XmlSerializer )
599
600    /**
601     * Method writePackageNameFeature.
602     * 
603     * @param packageNameFeature
604     * @param serializer
605     * @param tagName
606     * @throws java.io.IOException
607     */
608    private void writePackageNameFeature( PackageNameFeature packageNameFeature, String tagName, XmlSerializer serializer )
609        throws java.io.IOException
610    {
611        serializer.startTag( NAMESPACE, tagName );
612        if ( packageNameFeature.getReference() != null )
613        {
614            writeReference( (Reference) packageNameFeature.getReference(), "reference", serializer );
615        }
616        serializer.endTag( NAMESPACE, tagName );
617    } //-- void writePackageNameFeature( PackageNameFeature, String, XmlSerializer )
618
619    /**
620     * Method writeReference.
621     * 
622     * @param reference
623     * @param serializer
624     * @param tagName
625     * @throws java.io.IOException
626     */
627    private void writeReference( Reference reference, String tagName, XmlSerializer serializer )
628        throws java.io.IOException
629    {
630        serializer.startTag( NAMESPACE, tagName );
631        if ( reference.getId() != null )
632        {
633            serializer.startTag( NAMESPACE, "id" ).text( reference.getId() ).endTag( NAMESPACE, "id" );
634        }
635        serializer.endTag( NAMESPACE, tagName );
636    } //-- void writeReference( Reference, String, XmlSerializer )
637
638    /**
639     * Method writeSimpleTypes.
640     * 
641     * @param simpleTypes
642     * @param serializer
643     * @param tagName
644     * @throws java.io.IOException
645     */
646    private void writeSimpleTypes( SimpleTypes simpleTypes, String tagName, XmlSerializer serializer )
647        throws java.io.IOException
648    {
649        serializer.startTag( NAMESPACE, tagName );
650        if ( simpleTypes.isPrimitiveBoolean() != true )
651        {
652            serializer.startTag( NAMESPACE, "primitiveBoolean" ).text( String.valueOf( simpleTypes.isPrimitiveBoolean() ) ).endTag( NAMESPACE, "primitiveBoolean" );
653        }
654        if ( simpleTypes.getPrimitiveChar() != 'H' )
655        {
656            serializer.startTag( NAMESPACE, "primitiveChar" ).text( String.valueOf( simpleTypes.getPrimitiveChar() ) ).endTag( NAMESPACE, "primitiveChar" );
657        }
658        if ( simpleTypes.getPrimitiveByte() != 12 )
659        {
660            serializer.startTag( NAMESPACE, "primitiveByte" ).text( String.valueOf( simpleTypes.getPrimitiveByte() ) ).endTag( NAMESPACE, "primitiveByte" );
661        }
662        if ( simpleTypes.getPrimitiveShort() != 1212 )
663        {
664            serializer.startTag( NAMESPACE, "primitiveShort" ).text( String.valueOf( simpleTypes.getPrimitiveShort() ) ).endTag( NAMESPACE, "primitiveShort" );
665        }
666        if ( simpleTypes.getPrimitiveInt() != 121212 )
667        {
668            serializer.startTag( NAMESPACE, "primitiveInt" ).text( String.valueOf( simpleTypes.getPrimitiveInt() ) ).endTag( NAMESPACE, "primitiveInt" );
669        }
670        if ( simpleTypes.getPrimitiveLong() != 1234567890123L )
671        {
672            serializer.startTag( NAMESPACE, "primitiveLong" ).text( String.valueOf( simpleTypes.getPrimitiveLong() ) ).endTag( NAMESPACE, "primitiveLong" );
673        }
674        if ( simpleTypes.getPrimitiveFloat() != 12.12f )
675        {
676            serializer.startTag( NAMESPACE, "primitiveFloat" ).text( String.valueOf( simpleTypes.getPrimitiveFloat() ) ).endTag( NAMESPACE, "primitiveFloat" );
677        }
678        if ( simpleTypes.getPrimitiveDouble() != 12.12 )
679        {
680            serializer.startTag( NAMESPACE, "primitiveDouble" ).text( String.valueOf( simpleTypes.getPrimitiveDouble() ) ).endTag( NAMESPACE, "primitiveDouble" );
681        }
682        if ( ( simpleTypes.getObjectString() != null ) && !simpleTypes.getObjectString().equals( "default value" ) )
683        {
684            serializer.startTag( NAMESPACE, "objectString" ).text( simpleTypes.getObjectString() ).endTag( NAMESPACE, "objectString" );
685        }
686        if ( ( simpleTypes.getObjectDate() != null ) && !simpleTypes.getObjectDate().equals( new java.util.Date( 1356383532012L ) ) )
687        {
688            serializer.startTag( NAMESPACE, "objectDate" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( simpleTypes.getObjectDate() ) ).endTag( NAMESPACE, "objectDate" );
689        }
690        if ( simpleTypes.isPrimitiveBooleanNoDefault() != false )
691        {
692            serializer.startTag( NAMESPACE, "primitiveBooleanNoDefault" ).text( String.valueOf( simpleTypes.isPrimitiveBooleanNoDefault() ) ).endTag( NAMESPACE, "primitiveBooleanNoDefault" );
693        }
694        if ( simpleTypes.getPrimitiveCharNoDefault() != '\0' )
695        {
696            serializer.startTag( NAMESPACE, "primitiveCharNoDefault" ).text( String.valueOf( simpleTypes.getPrimitiveCharNoDefault() ) ).endTag( NAMESPACE, "primitiveCharNoDefault" );
697        }
698        if ( simpleTypes.getPrimitiveByteNoDefault() != 0 )
699        {
700            serializer.startTag( NAMESPACE, "primitiveByteNoDefault" ).text( String.valueOf( simpleTypes.getPrimitiveByteNoDefault() ) ).endTag( NAMESPACE, "primitiveByteNoDefault" );
701        }
702        if ( simpleTypes.getPrimitiveShortNoDefault() != 0 )
703        {
704            serializer.startTag( NAMESPACE, "primitiveShortNoDefault" ).text( String.valueOf( simpleTypes.getPrimitiveShortNoDefault() ) ).endTag( NAMESPACE, "primitiveShortNoDefault" );
705        }
706        if ( simpleTypes.getPrimitiveIntNoDefault() != 0 )
707        {
708            serializer.startTag( NAMESPACE, "primitiveIntNoDefault" ).text( String.valueOf( simpleTypes.getPrimitiveIntNoDefault() ) ).endTag( NAMESPACE, "primitiveIntNoDefault" );
709        }
710        if ( simpleTypes.getPrimitiveLongNoDefault() != 0L )
711        {
712            serializer.startTag( NAMESPACE, "primitiveLongNoDefault" ).text( String.valueOf( simpleTypes.getPrimitiveLongNoDefault() ) ).endTag( NAMESPACE, "primitiveLongNoDefault" );
713        }
714        if ( simpleTypes.getPrimitiveFloatNoDefault() != 0.0f )
715        {
716            serializer.startTag( NAMESPACE, "primitiveFloatNoDefault" ).text( String.valueOf( simpleTypes.getPrimitiveFloatNoDefault() ) ).endTag( NAMESPACE, "primitiveFloatNoDefault" );
717        }
718        if ( simpleTypes.getPrimitiveDoubleNoDefault() != 0.0 )
719        {
720            serializer.startTag( NAMESPACE, "primitiveDoubleNoDefault" ).text( String.valueOf( simpleTypes.getPrimitiveDoubleNoDefault() ) ).endTag( NAMESPACE, "primitiveDoubleNoDefault" );
721        }
722        if ( simpleTypes.getObjectStringNoDefault() != null )
723        {
724            serializer.startTag( NAMESPACE, "objectStringNoDefault" ).text( simpleTypes.getObjectStringNoDefault() ).endTag( NAMESPACE, "objectStringNoDefault" );
725        }
726        if ( simpleTypes.getObjectDateNoDefault() != null )
727        {
728            serializer.startTag( NAMESPACE, "objectDateNoDefault" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( simpleTypes.getObjectDateNoDefault() ) ).endTag( NAMESPACE, "objectDateNoDefault" );
729        }
730        if ( simpleTypes.getDom() != null )
731        {
732            ((Xpp3Dom) simpleTypes.getDom()).writeToSerializer( NAMESPACE, serializer );
733        }
734        if ( simpleTypes.getContent() != null )
735        {
736            writeContentTest( (ContentTest) simpleTypes.getContent(), "content", serializer );
737        }
738        serializer.endTag( NAMESPACE, tagName );
739    } //-- void writeSimpleTypes( SimpleTypes, String, XmlSerializer )
740
741    /**
742     * Method writeSubClassLevel1.
743     * 
744     * @param subClassLevel1
745     * @param serializer
746     * @param tagName
747     * @throws java.io.IOException
748     */
749    private void writeSubClassLevel1( SubClassLevel1 subClassLevel1, String tagName, XmlSerializer serializer )
750        throws java.io.IOException
751    {
752        serializer.startTag( NAMESPACE, tagName );
753        if ( subClassLevel1.getSubAttribute1() != 0L )
754        {
755            serializer.attribute( NAMESPACE, "subAttribute1", String.valueOf( subClassLevel1.getSubAttribute1() ) );
756        }
757        if ( subClassLevel1.getBaseAttribute() != 0 )
758        {
759            serializer.attribute( NAMESPACE, "baseAttribute", String.valueOf( subClassLevel1.getBaseAttribute() ) );
760        }
761        if ( subClassLevel1.getSubElement1() != 0L )
762        {
763            serializer.startTag( NAMESPACE, "subElement1" ).text( String.valueOf( subClassLevel1.getSubElement1() ) ).endTag( NAMESPACE, "subElement1" );
764        }
765        if ( subClassLevel1.getBaseElement() != 0 )
766        {
767            serializer.startTag( NAMESPACE, "baseElement" ).text( String.valueOf( subClassLevel1.getBaseElement() ) ).endTag( NAMESPACE, "baseElement" );
768        }
769        serializer.endTag( NAMESPACE, tagName );
770    } //-- void writeSubClassLevel1( SubClassLevel1, String, XmlSerializer )
771
772    /**
773     * Method writeSubClassLevel2.
774     * 
775     * @param subClassLevel2
776     * @param serializer
777     * @param tagName
778     * @throws java.io.IOException
779     */
780    private void writeSubClassLevel2( SubClassLevel2 subClassLevel2, String tagName, XmlSerializer serializer )
781        throws java.io.IOException
782    {
783        serializer.startTag( NAMESPACE, tagName );
784        if ( subClassLevel2.getSubAttribute2() != 0.0f )
785        {
786            serializer.attribute( NAMESPACE, "subAttribute2", String.valueOf( subClassLevel2.getSubAttribute2() ) );
787        }
788        if ( subClassLevel2.getSubAttribute1() != 0L )
789        {
790            serializer.attribute( NAMESPACE, "subAttribute1", String.valueOf( subClassLevel2.getSubAttribute1() ) );
791        }
792        if ( subClassLevel2.getBaseAttribute() != 0 )
793        {
794            serializer.attribute( NAMESPACE, "baseAttribute", String.valueOf( subClassLevel2.getBaseAttribute() ) );
795        }
796        if ( subClassLevel2.getSubElement2() != 0.0f )
797        {
798            serializer.startTag( NAMESPACE, "subElement2" ).text( String.valueOf( subClassLevel2.getSubElement2() ) ).endTag( NAMESPACE, "subElement2" );
799        }
800        if ( subClassLevel2.getSubElement1() != 0L )
801        {
802            serializer.startTag( NAMESPACE, "subElement1" ).text( String.valueOf( subClassLevel2.getSubElement1() ) ).endTag( NAMESPACE, "subElement1" );
803        }
804        if ( subClassLevel2.getBaseElement() != 0 )
805        {
806            serializer.startTag( NAMESPACE, "baseElement" ).text( String.valueOf( subClassLevel2.getBaseElement() ) ).endTag( NAMESPACE, "baseElement" );
807        }
808        serializer.endTag( NAMESPACE, tagName );
809    } //-- void writeSubClassLevel2( SubClassLevel2, String, XmlSerializer )
810
811    /**
812     * Method writeSubClassLevel3.
813     * 
814     * @param subClassLevel3
815     * @param serializer
816     * @param tagName
817     * @throws java.io.IOException
818     */
819    private void writeSubClassLevel3( SubClassLevel3 subClassLevel3, String tagName, XmlSerializer serializer )
820        throws java.io.IOException
821    {
822        serializer.startTag( NAMESPACE, tagName );
823        if ( subClassLevel3.getSubAttribute3() != 0.0 )
824        {
825            serializer.attribute( NAMESPACE, "subAttribute3", String.valueOf( subClassLevel3.getSubAttribute3() ) );
826        }
827        if ( subClassLevel3.getSubAttribute2() != 0.0f )
828        {
829            serializer.attribute( NAMESPACE, "subAttribute2", String.valueOf( subClassLevel3.getSubAttribute2() ) );
830        }
831        if ( subClassLevel3.getSubAttribute1() != 0L )
832        {
833            serializer.attribute( NAMESPACE, "subAttribute1", String.valueOf( subClassLevel3.getSubAttribute1() ) );
834        }
835        if ( subClassLevel3.getBaseAttribute() != 0 )
836        {
837            serializer.attribute( NAMESPACE, "baseAttribute", String.valueOf( subClassLevel3.getBaseAttribute() ) );
838        }
839        if ( subClassLevel3.getSubElement3() != 0.0 )
840        {
841            serializer.startTag( NAMESPACE, "subElement3" ).text( String.valueOf( subClassLevel3.getSubElement3() ) ).endTag( NAMESPACE, "subElement3" );
842        }
843        if ( subClassLevel3.getSubElement2() != 0.0f )
844        {
845            serializer.startTag( NAMESPACE, "subElement2" ).text( String.valueOf( subClassLevel3.getSubElement2() ) ).endTag( NAMESPACE, "subElement2" );
846        }
847        if ( subClassLevel3.getSubElement1() != 0L )
848        {
849            serializer.startTag( NAMESPACE, "subElement1" ).text( String.valueOf( subClassLevel3.getSubElement1() ) ).endTag( NAMESPACE, "subElement1" );
850        }
851        if ( subClassLevel3.getBaseElement() != 0 )
852        {
853            serializer.startTag( NAMESPACE, "baseElement" ).text( String.valueOf( subClassLevel3.getBaseElement() ) ).endTag( NAMESPACE, "baseElement" );
854        }
855        serializer.endTag( NAMESPACE, tagName );
856    } //-- void writeSubClassLevel3( SubClassLevel3, String, XmlSerializer )
857
858    /**
859     * Method writeSuperThing.
860     * 
861     * @param superThing
862     * @param serializer
863     * @param tagName
864     * @throws java.io.IOException
865     */
866    private void writeSuperThing( SuperThing superThing, String tagName, XmlSerializer serializer )
867        throws java.io.IOException
868    {
869        serializer.startTag( NAMESPACE, tagName );
870        serializer.endTag( NAMESPACE, tagName );
871    } //-- void writeSuperThing( SuperThing, String, XmlSerializer )
872
873    /**
874     * Method writeThing.
875     * 
876     * @param thing
877     * @param serializer
878     * @param tagName
879     * @throws java.io.IOException
880     */
881    private void writeThing( Thing thing, String tagName, XmlSerializer serializer )
882        throws java.io.IOException
883    {
884        serializer.startTag( NAMESPACE, tagName );
885        if ( thing.isSomeBoolean() != false )
886        {
887            serializer.startTag( NAMESPACE, "someBoolean" ).text( String.valueOf( thing.isSomeBoolean() ) ).endTag( NAMESPACE, "someBoolean" );
888        }
889        if ( thing.getSomeChar() != '\0' )
890        {
891            serializer.startTag( NAMESPACE, "someChar" ).text( String.valueOf( thing.getSomeChar() ) ).endTag( NAMESPACE, "someChar" );
892        }
893        if ( thing.getSomeByte() != 0 )
894        {
895            serializer.startTag( NAMESPACE, "someByte" ).text( String.valueOf( thing.getSomeByte() ) ).endTag( NAMESPACE, "someByte" );
896        }
897        if ( thing.getSomeShort() != 0 )
898        {
899            serializer.startTag( NAMESPACE, "someShort" ).text( String.valueOf( thing.getSomeShort() ) ).endTag( NAMESPACE, "someShort" );
900        }
901        if ( thing.getSomeInt() != 0 )
902        {
903            serializer.startTag( NAMESPACE, "someInt" ).text( String.valueOf( thing.getSomeInt() ) ).endTag( NAMESPACE, "someInt" );
904        }
905        if ( thing.getSomeLong() != 0L )
906        {
907            serializer.startTag( NAMESPACE, "someLong" ).text( String.valueOf( thing.getSomeLong() ) ).endTag( NAMESPACE, "someLong" );
908        }
909        if ( thing.getSomeFloat() != 0.0f )
910        {
911            serializer.startTag( NAMESPACE, "someFloat" ).text( String.valueOf( thing.getSomeFloat() ) ).endTag( NAMESPACE, "someFloat" );
912        }
913        if ( thing.getSomeDouble() != 0.0 )
914        {
915            serializer.startTag( NAMESPACE, "someDouble" ).text( String.valueOf( thing.getSomeDouble() ) ).endTag( NAMESPACE, "someDouble" );
916        }
917        if ( thing.getSomeString() != null )
918        {
919            serializer.startTag( NAMESPACE, "someString" ).text( thing.getSomeString() ).endTag( NAMESPACE, "someString" );
920        }
921        if ( thing.getSomeDate() != null )
922        {
923            serializer.startTag( NAMESPACE, "someDate" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( thing.getSomeDate() ) ).endTag( NAMESPACE, "someDate" );
924        }
925        if ( thing.getSomeDom() != null )
926        {
927            ((Xpp3Dom) thing.getSomeDom()).writeToSerializer( NAMESPACE, serializer );
928        }
929        if ( ( thing.getSomeProperties() != null ) && ( thing.getSomeProperties().size() > 0 ) )
930        {
931            serializer.startTag( NAMESPACE, "someProperties" );
932            for ( Iterator iter = thing.getSomeProperties().keySet().iterator(); iter.hasNext(); )
933            {
934                String key = (String) iter.next();
935                String value = (String) thing.getSomeProperties().get( key );
936                serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" );
937            }
938            serializer.endTag( NAMESPACE, "someProperties" );
939        }
940        if ( ( thing.getSomeStringList() != null ) && ( thing.getSomeStringList().size() > 0 ) )
941        {
942            serializer.startTag( NAMESPACE, "someStringList" );
943            for ( Iterator iter = thing.getSomeStringList().iterator(); iter.hasNext(); )
944            {
945                String someStringList = (String) iter.next();
946                serializer.startTag( NAMESPACE, "someStringList" ).text( someStringList ).endTag( NAMESPACE, "someStringList" );
947            }
948            serializer.endTag( NAMESPACE, "someStringList" );
949        }
950        if ( ( thing.getSomeStringSet() != null ) && ( thing.getSomeStringSet().size() > 0 ) )
951        {
952            serializer.startTag( NAMESPACE, "someStringSet" );
953            for ( Iterator iter = thing.getSomeStringSet().iterator(); iter.hasNext(); )
954            {
955                String someStringSet = (String) iter.next();
956                serializer.startTag( NAMESPACE, "someStringSet" ).text( someStringSet ).endTag( NAMESPACE, "someStringSet" );
957            }
958            serializer.endTag( NAMESPACE, "someStringSet" );
959        }
960        if ( thing.getDeepThingy() != null )
961        {
962            writeThingy( (Thingy) thing.getDeepThingy(), "deepThingy", serializer );
963        }
964        if ( ( thing.getDeepThingyList() != null ) && ( thing.getDeepThingyList().size() > 0 ) )
965        {
966            serializer.startTag( NAMESPACE, "deepThingyList" );
967            for ( Iterator iter = thing.getDeepThingyList().iterator(); iter.hasNext(); )
968            {
969                Thingy o = (Thingy) iter.next();
970                writeThingy( o, "deepThingyList", serializer );
971            }
972            serializer.endTag( NAMESPACE, "deepThingyList" );
973        }
974        if ( ( thing.getDeepThingySet() != null ) && ( thing.getDeepThingySet().size() > 0 ) )
975        {
976            serializer.startTag( NAMESPACE, "deepThingySet" );
977            for ( Iterator iter = thing.getDeepThingySet().iterator(); iter.hasNext(); )
978            {
979                Thingy o = (Thingy) iter.next();
980                writeThingy( o, "deepThingySet", serializer );
981            }
982            serializer.endTag( NAMESPACE, "deepThingySet" );
983        }
984        if ( thing.getShallowThingy() != null )
985        {
986            writeThingy( (Thingy) thing.getShallowThingy(), "shallowThingy", serializer );
987        }
988        if ( ( thing.getShallowThingyList() != null ) && ( thing.getShallowThingyList().size() > 0 ) )
989        {
990            serializer.startTag( NAMESPACE, "shallowThingyList" );
991            for ( Iterator iter = thing.getShallowThingyList().iterator(); iter.hasNext(); )
992            {
993                Thingy o = (Thingy) iter.next();
994                writeThingy( o, "shallowThingyList", serializer );
995            }
996            serializer.endTag( NAMESPACE, "shallowThingyList" );
997        }
998        if ( ( thing.getShallowThingySet() != null ) && ( thing.getShallowThingySet().size() > 0 ) )
999        {
1000            serializer.startTag( NAMESPACE, "shallowThingySet" );
1001            for ( Iterator iter = thing.getShallowThingySet().iterator(); iter.hasNext(); )
1002            {
1003                Thingy o = (Thingy) iter.next();
1004                writeThingy( o, "shallowThingySet", serializer );
1005            }
1006            serializer.endTag( NAMESPACE, "shallowThingySet" );
1007        }
1008        serializer.endTag( NAMESPACE, tagName );
1009    } //-- void writeThing( Thing, String, XmlSerializer )
1010
1011    /**
1012     * Method writeThingy.
1013     * 
1014     * @param thingy
1015     * @param serializer
1016     * @param tagName
1017     * @throws java.io.IOException
1018     */
1019    private void writeThingy( Thingy thingy, String tagName, XmlSerializer serializer )
1020        throws java.io.IOException
1021    {
1022        serializer.startTag( NAMESPACE, tagName );
1023        serializer.text( thingy.getSomeContent() );
1024        serializer.endTag( NAMESPACE, tagName );
1025    } //-- void writeThingy( Thingy, String, XmlSerializer )
1026
1027    /**
1028     * Method writeXdocFeatures.
1029     * 
1030     * @param xdocFeatures
1031     * @param serializer
1032     * @param tagName
1033     * @throws java.io.IOException
1034     */
1035    private void writeXdocFeatures( XdocFeatures xdocFeatures, String tagName, XmlSerializer serializer )
1036        throws java.io.IOException
1037    {
1038        serializer.startTag( NAMESPACE, tagName );
1039        if ( xdocFeatures.getField() != null )
1040        {
1041            serializer.startTag( NAMESPACE, "field" ).text( xdocFeatures.getField() ).endTag( NAMESPACE, "field" );
1042        }
1043        if ( xdocFeatures.getXdocSeparatorNone() != null )
1044        {
1045            serializer.startTag( NAMESPACE, "xdocSeparatorNone" ).text( xdocFeatures.getXdocSeparatorNone() ).endTag( NAMESPACE, "xdocSeparatorNone" );
1046        }
1047        if ( xdocFeatures.getXdocSeparatorBlank() != null )
1048        {
1049            serializer.startTag( NAMESPACE, "xdocSeparatorBlank" ).text( xdocFeatures.getXdocSeparatorBlank() ).endTag( NAMESPACE, "xdocSeparatorBlank" );
1050        }
1051        serializer.endTag( NAMESPACE, tagName );
1052    } //-- void writeXdocFeatures( XdocFeatures, String, XmlSerializer )
1053
1054    /**
1055     * Method writeXmlAttributes.
1056     * 
1057     * @param xmlAttributes
1058     * @param serializer
1059     * @param tagName
1060     * @throws java.io.IOException
1061     */
1062    private void writeXmlAttributes( XmlAttributes xmlAttributes, String tagName, XmlSerializer serializer )
1063        throws java.io.IOException
1064    {
1065        serializer.startTag( NAMESPACE, tagName );
1066        if ( xmlAttributes.isPrimitiveBoolean() != true )
1067        {
1068            serializer.attribute( NAMESPACE, "primitiveBoolean", String.valueOf( xmlAttributes.isPrimitiveBoolean() ) );
1069        }
1070        if ( xmlAttributes.getPrimitiveChar() != 'H' )
1071        {
1072            serializer.attribute( NAMESPACE, "primitiveChar", String.valueOf( xmlAttributes.getPrimitiveChar() ) );
1073        }
1074        if ( xmlAttributes.getPrimitiveByte() != 12 )
1075        {
1076            serializer.attribute( NAMESPACE, "primitiveByte", String.valueOf( xmlAttributes.getPrimitiveByte() ) );
1077        }
1078        if ( xmlAttributes.getPrimitiveShort() != 1212 )
1079        {
1080            serializer.attribute( NAMESPACE, "primitiveShort", String.valueOf( xmlAttributes.getPrimitiveShort() ) );
1081        }
1082        if ( xmlAttributes.getPrimitiveInt() != 121212 )
1083        {
1084            serializer.attribute( NAMESPACE, "primitiveInt", String.valueOf( xmlAttributes.getPrimitiveInt() ) );
1085        }
1086        if ( xmlAttributes.getPrimitiveLong() != 1234567890123L )
1087        {
1088            serializer.attribute( NAMESPACE, "primitiveLong", String.valueOf( xmlAttributes.getPrimitiveLong() ) );
1089        }
1090        if ( xmlAttributes.getPrimitiveFloat() != 12.12f )
1091        {
1092            serializer.attribute( NAMESPACE, "primitiveFloat", String.valueOf( xmlAttributes.getPrimitiveFloat() ) );
1093        }
1094        if ( xmlAttributes.getPrimitiveDouble() != 12.12 )
1095        {
1096            serializer.attribute( NAMESPACE, "primitiveDouble", String.valueOf( xmlAttributes.getPrimitiveDouble() ) );
1097        }
1098        if ( ( xmlAttributes.getObjectString() != null ) && !xmlAttributes.getObjectString().equals( "default value" ) )
1099        {
1100            serializer.attribute( NAMESPACE, "objectString", xmlAttributes.getObjectString() );
1101        }
1102        if ( xmlAttributes.getObjectDate() != null )
1103        {
1104            serializer.attribute( NAMESPACE, "objectDate", new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( xmlAttributes.getObjectDate() ) );
1105        }
1106        if ( ( xmlAttributes.getAttribute() != null ) && !xmlAttributes.getAttribute().equals( "default" ) )
1107        {
1108            serializer.attribute( NAMESPACE, "tag-name", xmlAttributes.getAttribute() );
1109        }
1110        serializer.endTag( NAMESPACE, tagName );
1111    } //-- void writeXmlAttributes( XmlAttributes, String, XmlSerializer )
1112
1113    /**
1114     * Method writeXmlContent.
1115     * 
1116     * @param xmlContent
1117     * @param serializer
1118     * @param tagName
1119     * @throws java.io.IOException
1120     */
1121    private void writeXmlContent( XmlContent xmlContent, String tagName, XmlSerializer serializer )
1122        throws java.io.IOException
1123    {
1124        serializer.startTag( NAMESPACE, tagName );
1125        if ( xmlContent.getLongContent() != null )
1126        {
1127            writeXmlContentLong( (XmlContentLong) xmlContent.getLongContent(), "content.long", serializer );
1128        }
1129        if ( xmlContent.getLongContentWithAttributes() != null )
1130        {
1131            writeXmlContentLongWithAttributes( (XmlContentLongWithAttributes) xmlContent.getLongContentWithAttributes(), "content.long-with-attributes", serializer );
1132        }
1133        serializer.endTag( NAMESPACE, tagName );
1134    } //-- void writeXmlContent( XmlContent, String, XmlSerializer )
1135
1136    /**
1137     * Method writeXmlContentLong.
1138     * 
1139     * @param xmlContentLong
1140     * @param serializer
1141     * @param tagName
1142     * @throws java.io.IOException
1143     */
1144    private void writeXmlContentLong( XmlContentLong xmlContentLong, String tagName, XmlSerializer serializer )
1145        throws java.io.IOException
1146    {
1147        serializer.startTag( NAMESPACE, tagName );
1148        serializer.text( String.valueOf( xmlContentLong.getContent() ) );
1149        serializer.endTag( NAMESPACE, tagName );
1150    } //-- void writeXmlContentLong( XmlContentLong, String, XmlSerializer )
1151
1152    /**
1153     * Method writeXmlContentLongWithAttributes.
1154     * 
1155     * @param xmlContentLongWithAttributes
1156     * @param serializer
1157     * @param tagName
1158     * @throws java.io.IOException
1159     */
1160    private void writeXmlContentLongWithAttributes( XmlContentLongWithAttributes xmlContentLongWithAttributes, String tagName, XmlSerializer serializer )
1161        throws java.io.IOException
1162    {
1163        serializer.startTag( NAMESPACE, tagName );
1164        if ( xmlContentLongWithAttributes.getAttr() != null )
1165        {
1166            serializer.attribute( NAMESPACE, "attr", xmlContentLongWithAttributes.getAttr() );
1167        }
1168        if ( xmlContentLongWithAttributes.getAttr2() != 0 )
1169        {
1170            serializer.attribute( NAMESPACE, "attr2", String.valueOf( xmlContentLongWithAttributes.getAttr2() ) );
1171        }
1172        serializer.text( String.valueOf( xmlContentLongWithAttributes.getContent() ) );
1173        serializer.endTag( NAMESPACE, tagName );
1174    } //-- void writeXmlContentLongWithAttributes( XmlContentLongWithAttributes, String, XmlSerializer )
1175
1176    /**
1177     * Method writeXmlFeatures.
1178     * 
1179     * @param xmlFeatures
1180     * @param serializer
1181     * @param tagName
1182     * @throws java.io.IOException
1183     */
1184    private void writeXmlFeatures( XmlFeatures xmlFeatures, String tagName, XmlSerializer serializer )
1185        throws java.io.IOException
1186    {
1187        serializer.startTag( NAMESPACE, tagName );
1188        if ( xmlFeatures.getFieldNameAttribute() != null )
1189        {
1190            serializer.attribute( NAMESPACE, "tag-name.attribute", xmlFeatures.getFieldNameAttribute() );
1191        }
1192        if ( xmlFeatures.getAttributes() != null )
1193        {
1194            writeXmlAttributes( (XmlAttributes) xmlFeatures.getAttributes(), "attributes", serializer );
1195        }
1196        if ( xmlFeatures.getAttributesDefault() != null )
1197        {
1198            writeXmlAttributes( (XmlAttributes) xmlFeatures.getAttributesDefault(), "attributesDefault", serializer );
1199        }
1200        if ( xmlFeatures.getContent() != null )
1201        {
1202            writeXmlContent( (XmlContent) xmlFeatures.getContent(), "content", serializer );
1203        }
1204        if ( xmlFeatures.getFieldTrim() != null )
1205        {
1206            serializer.startTag( NAMESPACE, "fieldTrim" ).text( xmlFeatures.getFieldTrim() ).endTag( NAMESPACE, "fieldTrim" );
1207        }
1208        if ( xmlFeatures.getFieldNoTrim() != null )
1209        {
1210            serializer.startTag( NAMESPACE, "fieldNoTrim" ).text( xmlFeatures.getFieldNoTrim() ).endTag( NAMESPACE, "fieldNoTrim" );
1211        }
1212        if ( xmlFeatures.getDom() != null )
1213        {
1214            ((Xpp3Dom) xmlFeatures.getDom()).writeToSerializer( NAMESPACE, serializer );
1215        }
1216        if ( xmlFeatures.getDomNoTrim() != null )
1217        {
1218            ((Xpp3Dom) xmlFeatures.getDomNoTrim()).writeToSerializer( NAMESPACE, serializer );
1219        }
1220        if ( xmlFeatures.getFieldName() != null )
1221        {
1222            serializer.startTag( NAMESPACE, "tag-name" ).text( xmlFeatures.getFieldName() ).endTag( NAMESPACE, "tag-name" );
1223        }
1224        if ( xmlFeatures.getDateXmlFormat() != null )
1225        {
1226            serializer.startTag( NAMESPACE, "dateXmlFormat" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss", java.util.Locale.US ).format( xmlFeatures.getDateXmlFormat() ) ).endTag( NAMESPACE, "dateXmlFormat" );
1227        }
1228        if ( xmlFeatures.getDateLong() != null )
1229        {
1230            serializer.startTag( NAMESPACE, "dateLong" ).text( String.valueOf( xmlFeatures.getDateLong().getTime() ) ).endTag( NAMESPACE, "dateLong" );
1231        }
1232        if ( ( xmlFeatures.getXmlItemsStyleFlats() != null ) && ( xmlFeatures.getXmlItemsStyleFlats().size() > 0 ) )
1233        {
1234            for ( Iterator iter = xmlFeatures.getXmlItemsStyleFlats().iterator(); iter.hasNext(); )
1235            {
1236                Reference o = (Reference) iter.next();
1237                writeReference( o, "xmlItemsStyleFlat", serializer );
1238            }
1239        }
1240        if ( ( xmlFeatures.getXmlAssociationTagNames() != null ) && ( xmlFeatures.getXmlAssociationTagNames().size() > 0 ) )
1241        {
1242            serializer.startTag( NAMESPACE, "xmlAssociationTagNames" );
1243            for ( Iterator iter = xmlFeatures.getXmlAssociationTagNames().iterator(); iter.hasNext(); )
1244            {
1245                Reference o = (Reference) iter.next();
1246                writeReference( o, "association.tag-name", serializer );
1247            }
1248            serializer.endTag( NAMESPACE, "xmlAssociationTagNames" );
1249        }
1250        if ( ( xmlFeatures.getXmlTagNameAssociation() != null ) && ( xmlFeatures.getXmlTagNameAssociation().size() > 0 ) )
1251        {
1252            serializer.startTag( NAMESPACE, "field.tag-names" );
1253            for ( Iterator iter = xmlFeatures.getXmlTagNameAssociation().iterator(); iter.hasNext(); )
1254            {
1255                Reference o = (Reference) iter.next();
1256                writeReference( o, "field.tag-name", serializer );
1257            }
1258            serializer.endTag( NAMESPACE, "field.tag-names" );
1259        }
1260        if ( ( xmlFeatures.getXmlTagNameAssociationTagNames() != null ) && ( xmlFeatures.getXmlTagNameAssociationTagNames().size() > 0 ) )
1261        {
1262            serializer.startTag( NAMESPACE, "field.tag-name" );
1263            for ( Iterator iter = xmlFeatures.getXmlTagNameAssociationTagNames().iterator(); iter.hasNext(); )
1264            {
1265                Reference o = (Reference) iter.next();
1266                writeReference( o, "association.tag-name", serializer );
1267            }
1268            serializer.endTag( NAMESPACE, "field.tag-name" );
1269        }
1270        if ( ( xmlFeatures.getXmlFlatAssociationTagNames() != null ) && ( xmlFeatures.getXmlFlatAssociationTagNames().size() > 0 ) )
1271        {
1272            for ( Iterator iter = xmlFeatures.getXmlFlatAssociationTagNames().iterator(); iter.hasNext(); )
1273            {
1274                Reference o = (Reference) iter.next();
1275                writeReference( o, "association.tag-name", serializer );
1276            }
1277        }
1278        if ( ( xmlFeatures.getExplodeProperties() != null ) && ( xmlFeatures.getExplodeProperties().size() > 0 ) )
1279        {
1280            serializer.startTag( NAMESPACE, "explodeProperties" );
1281            for ( Iterator iter = xmlFeatures.getExplodeProperties().keySet().iterator(); iter.hasNext(); )
1282            {
1283                String key = (String) iter.next();
1284                String value = (String) xmlFeatures.getExplodeProperties().get( key );
1285                serializer.startTag( NAMESPACE, "explodeProperty" );
1286                serializer.startTag( NAMESPACE, "key" ).text( key ).endTag( NAMESPACE, "key" );
1287                serializer.startTag( NAMESPACE, "value" ).text( value ).endTag( NAMESPACE, "value" );
1288                serializer.endTag( NAMESPACE, "explodeProperty" );
1289            }
1290            serializer.endTag( NAMESPACE, "explodeProperties" );
1291        }
1292        if ( ( xmlFeatures.getInlineProperties() != null ) && ( xmlFeatures.getInlineProperties().size() > 0 ) )
1293        {
1294            serializer.startTag( NAMESPACE, "inlineProperties" );
1295            for ( Iterator iter = xmlFeatures.getInlineProperties().keySet().iterator(); iter.hasNext(); )
1296            {
1297                String key = (String) iter.next();
1298                String value = (String) xmlFeatures.getInlineProperties().get( key );
1299                serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" );
1300            }
1301            serializer.endTag( NAMESPACE, "inlineProperties" );
1302        }
1303        if ( xmlFeatures.getXmlTransientFields() != null )
1304        {
1305            writeXmlTransientFields( (XmlTransientFields) xmlFeatures.getXmlTransientFields(), "xmlTransientFields", serializer );
1306        }
1307        if ( xmlFeatures.getXmlFieldsOrder() != null )
1308        {
1309            writeXmlFieldsOrder( (XmlFieldsOrder) xmlFeatures.getXmlFieldsOrder(), "xmlFieldsOrder", serializer );
1310        }
1311        if ( xmlFeatures.getXsdFeatures() != null )
1312        {
1313            writeXsdFeatures( (XsdFeatures) xmlFeatures.getXsdFeatures(), "xsdFeatures", serializer );
1314        }
1315        serializer.endTag( NAMESPACE, tagName );
1316    } //-- void writeXmlFeatures( XmlFeatures, String, XmlSerializer )
1317
1318    /**
1319     * Method writeXmlFieldsOrder.
1320     * 
1321     * @param xmlFieldsOrder
1322     * @param serializer
1323     * @param tagName
1324     * @throws java.io.IOException
1325     */
1326    private void writeXmlFieldsOrder( XmlFieldsOrder xmlFieldsOrder, String tagName, XmlSerializer serializer )
1327        throws java.io.IOException
1328    {
1329        serializer.startTag( NAMESPACE, tagName );
1330        if ( xmlFieldsOrder.getField1() != null )
1331        {
1332            serializer.startTag( NAMESPACE, "field1" ).text( xmlFieldsOrder.getField1() ).endTag( NAMESPACE, "field1" );
1333        }
1334        if ( xmlFieldsOrder.getField() != null )
1335        {
1336            serializer.startTag( NAMESPACE, "field-2" ).text( xmlFieldsOrder.getField() ).endTag( NAMESPACE, "field-2" );
1337        }
1338        if ( xmlFieldsOrder.getField3() != null )
1339        {
1340            serializer.startTag( NAMESPACE, "field3" ).text( xmlFieldsOrder.getField3() ).endTag( NAMESPACE, "field3" );
1341        }
1342        if ( xmlFieldsOrder.getField4() != null )
1343        {
1344            serializer.startTag( NAMESPACE, "field4" ).text( xmlFieldsOrder.getField4() ).endTag( NAMESPACE, "field4" );
1345        }
1346        if ( xmlFieldsOrder.getField5() != null )
1347        {
1348            serializer.startTag( NAMESPACE, "field5" ).text( xmlFieldsOrder.getField5() ).endTag( NAMESPACE, "field5" );
1349        }
1350        if ( xmlFieldsOrder.getField6() != null )
1351        {
1352            serializer.startTag( NAMESPACE, "field6" ).text( xmlFieldsOrder.getField6() ).endTag( NAMESPACE, "field6" );
1353        }
1354        if ( xmlFieldsOrder.getField7() != null )
1355        {
1356            serializer.startTag( NAMESPACE, "field7" ).text( xmlFieldsOrder.getField7() ).endTag( NAMESPACE, "field7" );
1357        }
1358        serializer.endTag( NAMESPACE, tagName );
1359    } //-- void writeXmlFieldsOrder( XmlFieldsOrder, String, XmlSerializer )
1360
1361    /**
1362     * Method writeXmlFieldsOrderParent.
1363     * 
1364     * @param xmlFieldsOrderParent
1365     * @param serializer
1366     * @param tagName
1367     * @throws java.io.IOException
1368     */
1369    private void writeXmlFieldsOrderParent( XmlFieldsOrderParent xmlFieldsOrderParent, String tagName, XmlSerializer serializer )
1370        throws java.io.IOException
1371    {
1372        serializer.startTag( NAMESPACE, tagName );
1373        if ( xmlFieldsOrderParent.getField() != null )
1374        {
1375            serializer.startTag( NAMESPACE, "field-2" ).text( xmlFieldsOrderParent.getField() ).endTag( NAMESPACE, "field-2" );
1376        }
1377        if ( xmlFieldsOrderParent.getField4() != null )
1378        {
1379            serializer.startTag( NAMESPACE, "field4" ).text( xmlFieldsOrderParent.getField4() ).endTag( NAMESPACE, "field4" );
1380        }
1381        if ( xmlFieldsOrderParent.getField5() != null )
1382        {
1383            serializer.startTag( NAMESPACE, "field5" ).text( xmlFieldsOrderParent.getField5() ).endTag( NAMESPACE, "field5" );
1384        }
1385        if ( xmlFieldsOrderParent.getField7() != null )
1386        {
1387            serializer.startTag( NAMESPACE, "field7" ).text( xmlFieldsOrderParent.getField7() ).endTag( NAMESPACE, "field7" );
1388        }
1389        serializer.endTag( NAMESPACE, tagName );
1390    } //-- void writeXmlFieldsOrderParent( XmlFieldsOrderParent, String, XmlSerializer )
1391
1392    /**
1393     * Method writeXmlFieldsOrderParent2.
1394     * 
1395     * @param xmlFieldsOrderParent2
1396     * @param serializer
1397     * @param tagName
1398     * @throws java.io.IOException
1399     */
1400    private void writeXmlFieldsOrderParent2( XmlFieldsOrderParent2 xmlFieldsOrderParent2, String tagName, XmlSerializer serializer )
1401        throws java.io.IOException
1402    {
1403        serializer.startTag( NAMESPACE, tagName );
1404        if ( xmlFieldsOrderParent2.getField() != null )
1405        {
1406            serializer.startTag( NAMESPACE, "field-2" ).text( xmlFieldsOrderParent2.getField() ).endTag( NAMESPACE, "field-2" );
1407        }
1408        serializer.endTag( NAMESPACE, tagName );
1409    } //-- void writeXmlFieldsOrderParent2( XmlFieldsOrderParent2, String, XmlSerializer )
1410
1411    /**
1412     * Method writeXmlTransientFields.
1413     * 
1414     * @param xmlTransientFields
1415     * @param serializer
1416     * @param tagName
1417     * @throws java.io.IOException
1418     */
1419    private void writeXmlTransientFields( XmlTransientFields xmlTransientFields, String tagName, XmlSerializer serializer )
1420        throws java.io.IOException
1421    {
1422        serializer.startTag( NAMESPACE, tagName );
1423        if ( xmlTransientFields.getPersistentField() != null )
1424        {
1425            serializer.startTag( NAMESPACE, "persistentField" ).text( xmlTransientFields.getPersistentField() ).endTag( NAMESPACE, "persistentField" );
1426        }
1427        serializer.endTag( NAMESPACE, tagName );
1428    } //-- void writeXmlTransientFields( XmlTransientFields, String, XmlSerializer )
1429
1430    /**
1431     * Method writeXsdFeatures.
1432     * 
1433     * @param xsdFeatures
1434     * @param serializer
1435     * @param tagName
1436     * @throws java.io.IOException
1437     */
1438    private void writeXsdFeatures( XsdFeatures xsdFeatures, String tagName, XmlSerializer serializer )
1439        throws java.io.IOException
1440    {
1441        serializer.startTag( NAMESPACE, tagName );
1442        if ( xsdFeatures.getAttribute() != null )
1443        {
1444            serializer.attribute( NAMESPACE, "attribute", xsdFeatures.getAttribute() );
1445        }
1446        serializer.endTag( NAMESPACE, tagName );
1447    } //-- void writeXsdFeatures( XsdFeatures, String, XmlSerializer )
1448
1449}