View Javadoc

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