View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.4.1 on 2013-11-14 22:15:37,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.doxia.document.io.xpp3;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import java.io.OutputStream;
15  import java.io.Writer;
16  import java.text.DateFormat;
17  import java.util.Iterator;
18  import java.util.Locale;
19  import org.apache.maven.doxia.document.DocumentAuthor;
20  import org.apache.maven.doxia.document.DocumentCover;
21  import org.apache.maven.doxia.document.DocumentHyperlinkBehaviour;
22  import org.apache.maven.doxia.document.DocumentMeta;
23  import org.apache.maven.doxia.document.DocumentModel;
24  import org.apache.maven.doxia.document.DocumentStatistic;
25  import org.apache.maven.doxia.document.DocumentTOC;
26  import org.apache.maven.doxia.document.DocumentTOCItem;
27  import org.apache.maven.doxia.document.DocumentTemplate;
28  import org.codehaus.plexus.util.xml.pull.MXSerializer;
29  import org.codehaus.plexus.util.xml.pull.XmlSerializer;
30  
31  /**
32   * Class DocumentXpp3Writer.
33   * 
34   * @version $Revision$ $Date$
35   */
36  @SuppressWarnings( "all" )
37  public class DocumentXpp3Writer
38  {
39  
40        //--------------------------/
41       //- Class/Member Variables -/
42      //--------------------------/
43  
44      /**
45       * Field NAMESPACE.
46       */
47      private static final String NAMESPACE = null;
48  
49  
50        //-----------/
51       //- Methods -/
52      //-----------/
53  
54      /**
55       * Method write.
56       * 
57       * @param writer
58       * @param documentModel
59       * @throws java.io.IOException
60       */
61      public void write( Writer writer, DocumentModel documentModel )
62          throws java.io.IOException
63      {
64          XmlSerializer serializer = new MXSerializer();
65          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
66          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
67          serializer.setOutput( writer );
68          serializer.startDocument( documentModel.getModelEncoding(), null );
69          writeDocumentModel( documentModel, "document", serializer );
70          serializer.endDocument();
71      } //-- void write( Writer, DocumentModel )
72  
73      /**
74       * Method write.
75       * 
76       * @param stream
77       * @param documentModel
78       * @throws java.io.IOException
79       */
80      public void write( OutputStream stream, DocumentModel documentModel )
81          throws java.io.IOException
82      {
83          XmlSerializer serializer = new MXSerializer();
84          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
85          serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
86          serializer.setOutput( stream, documentModel.getModelEncoding() );
87          serializer.startDocument( documentModel.getModelEncoding(), null );
88          writeDocumentModel( documentModel, "document", serializer );
89          serializer.endDocument();
90      } //-- void write( OutputStream, DocumentModel )
91  
92      /**
93       * Method writeDocumentAuthor.
94       * 
95       * @param documentAuthor
96       * @param serializer
97       * @param tagName
98       * @throws java.io.IOException
99       */
100     private void writeDocumentAuthor( DocumentAuthor documentAuthor, String tagName, XmlSerializer serializer )
101         throws java.io.IOException
102     {
103         serializer.startTag( NAMESPACE, tagName );
104         if ( documentAuthor.getFirstName() != null )
105         {
106             serializer.startTag( NAMESPACE, "firstName" ).text( documentAuthor.getFirstName() ).endTag( NAMESPACE, "firstName" );
107         }
108         if ( documentAuthor.getLastName() != null )
109         {
110             serializer.startTag( NAMESPACE, "lastName" ).text( documentAuthor.getLastName() ).endTag( NAMESPACE, "lastName" );
111         }
112         if ( documentAuthor.getName() != null )
113         {
114             serializer.startTag( NAMESPACE, "name" ).text( documentAuthor.getName() ).endTag( NAMESPACE, "name" );
115         }
116         if ( documentAuthor.getInitials() != null )
117         {
118             serializer.startTag( NAMESPACE, "initials" ).text( documentAuthor.getInitials() ).endTag( NAMESPACE, "initials" );
119         }
120         if ( documentAuthor.getTitle() != null )
121         {
122             serializer.startTag( NAMESPACE, "title" ).text( documentAuthor.getTitle() ).endTag( NAMESPACE, "title" );
123         }
124         if ( documentAuthor.getPosition() != null )
125         {
126             serializer.startTag( NAMESPACE, "position" ).text( documentAuthor.getPosition() ).endTag( NAMESPACE, "position" );
127         }
128         if ( documentAuthor.getEmail() != null )
129         {
130             serializer.startTag( NAMESPACE, "email" ).text( documentAuthor.getEmail() ).endTag( NAMESPACE, "email" );
131         }
132         if ( documentAuthor.getPhoneNumber() != null )
133         {
134             serializer.startTag( NAMESPACE, "phoneNumber" ).text( documentAuthor.getPhoneNumber() ).endTag( NAMESPACE, "phoneNumber" );
135         }
136         if ( documentAuthor.getFaxNumber() != null )
137         {
138             serializer.startTag( NAMESPACE, "faxNumber" ).text( documentAuthor.getFaxNumber() ).endTag( NAMESPACE, "faxNumber" );
139         }
140         if ( documentAuthor.getCompanyName() != null )
141         {
142             serializer.startTag( NAMESPACE, "companyName" ).text( documentAuthor.getCompanyName() ).endTag( NAMESPACE, "companyName" );
143         }
144         if ( documentAuthor.getStreet() != null )
145         {
146             serializer.startTag( NAMESPACE, "street" ).text( documentAuthor.getStreet() ).endTag( NAMESPACE, "street" );
147         }
148         if ( documentAuthor.getCity() != null )
149         {
150             serializer.startTag( NAMESPACE, "city" ).text( documentAuthor.getCity() ).endTag( NAMESPACE, "city" );
151         }
152         if ( documentAuthor.getPostalCode() != null )
153         {
154             serializer.startTag( NAMESPACE, "postalCode" ).text( documentAuthor.getPostalCode() ).endTag( NAMESPACE, "postalCode" );
155         }
156         if ( documentAuthor.getCountry() != null )
157         {
158             serializer.startTag( NAMESPACE, "country" ).text( documentAuthor.getCountry() ).endTag( NAMESPACE, "country" );
159         }
160         if ( documentAuthor.getState() != null )
161         {
162             serializer.startTag( NAMESPACE, "state" ).text( documentAuthor.getState() ).endTag( NAMESPACE, "state" );
163         }
164         serializer.endTag( NAMESPACE, tagName );
165     } //-- void writeDocumentAuthor( DocumentAuthor, String, XmlSerializer )
166 
167     /**
168      * Method writeDocumentCover.
169      * 
170      * @param documentCover
171      * @param serializer
172      * @param tagName
173      * @throws java.io.IOException
174      */
175     private void writeDocumentCover( DocumentCover documentCover, String tagName, XmlSerializer serializer )
176         throws java.io.IOException
177     {
178         serializer.startTag( NAMESPACE, tagName );
179         if ( documentCover.getCoverTitle() != null )
180         {
181             serializer.startTag( NAMESPACE, "coverTitle" ).text( documentCover.getCoverTitle() ).endTag( NAMESPACE, "coverTitle" );
182         }
183         if ( documentCover.getCoverSubTitle() != null )
184         {
185             serializer.startTag( NAMESPACE, "coverSubTitle" ).text( documentCover.getCoverSubTitle() ).endTag( NAMESPACE, "coverSubTitle" );
186         }
187         if ( documentCover.getCoverVersion() != null )
188         {
189             serializer.startTag( NAMESPACE, "coverVersion" ).text( documentCover.getCoverVersion() ).endTag( NAMESPACE, "coverVersion" );
190         }
191         if ( documentCover.getCoverType() != null )
192         {
193             serializer.startTag( NAMESPACE, "coverType" ).text( documentCover.getCoverType() ).endTag( NAMESPACE, "coverType" );
194         }
195         if ( documentCover.getCoverDate() != null )
196         {
197             serializer.startTag( NAMESPACE, "coverDate" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US ).format( documentCover.getCoverDate() ) ).endTag( NAMESPACE, "coverDate" );
198         }
199         if ( documentCover.getCoverdate() != null )
200         {
201             serializer.startTag( NAMESPACE, "coverdate" ).text( documentCover.getCoverdate() ).endTag( NAMESPACE, "coverdate" );
202         }
203         if ( ( documentCover.getAuthors() != null ) && ( documentCover.getAuthors().size() > 0 ) )
204         {
205             serializer.startTag( NAMESPACE, "authors" );
206             for ( Iterator iter = documentCover.getAuthors().iterator(); iter.hasNext(); )
207             {
208                 DocumentAuthor o = (DocumentAuthor) iter.next();
209                 writeDocumentAuthor( o, "author", serializer );
210             }
211             serializer.endTag( NAMESPACE, "authors" );
212         }
213         if ( documentCover.getAuthor() != null )
214         {
215             serializer.startTag( NAMESPACE, "author" ).text( documentCover.getAuthor() ).endTag( NAMESPACE, "author" );
216         }
217         if ( documentCover.getProjectName() != null )
218         {
219             serializer.startTag( NAMESPACE, "projectName" ).text( documentCover.getProjectName() ).endTag( NAMESPACE, "projectName" );
220         }
221         if ( documentCover.getProjectLogo() != null )
222         {
223             serializer.startTag( NAMESPACE, "projectLogo" ).text( documentCover.getProjectLogo() ).endTag( NAMESPACE, "projectLogo" );
224         }
225         if ( documentCover.getCompanyName() != null )
226         {
227             serializer.startTag( NAMESPACE, "companyName" ).text( documentCover.getCompanyName() ).endTag( NAMESPACE, "companyName" );
228         }
229         if ( documentCover.getCompanyLogo() != null )
230         {
231             serializer.startTag( NAMESPACE, "companyLogo" ).text( documentCover.getCompanyLogo() ).endTag( NAMESPACE, "companyLogo" );
232         }
233         serializer.endTag( NAMESPACE, tagName );
234     } //-- void writeDocumentCover( DocumentCover, String, XmlSerializer )
235 
236     /**
237      * Method writeDocumentHyperlinkBehaviour.
238      * 
239      * @param documentHyperlinkBehaviour
240      * @param serializer
241      * @param tagName
242      * @throws java.io.IOException
243      */
244     private void writeDocumentHyperlinkBehaviour( DocumentHyperlinkBehaviour documentHyperlinkBehaviour, String tagName, XmlSerializer serializer )
245         throws java.io.IOException
246     {
247         serializer.startTag( NAMESPACE, tagName );
248         if ( ( documentHyperlinkBehaviour.getTargetFrame() != null ) && !documentHyperlinkBehaviour.getTargetFrame().equals( "_self" ) )
249         {
250             serializer.attribute( NAMESPACE, "targetFrame", documentHyperlinkBehaviour.getTargetFrame() );
251         }
252         serializer.endTag( NAMESPACE, tagName );
253     } //-- void writeDocumentHyperlinkBehaviour( DocumentHyperlinkBehaviour, String, XmlSerializer )
254 
255     /**
256      * Method writeDocumentMeta.
257      * 
258      * @param documentMeta
259      * @param serializer
260      * @param tagName
261      * @throws java.io.IOException
262      */
263     private void writeDocumentMeta( DocumentMeta documentMeta, String tagName, XmlSerializer serializer )
264         throws java.io.IOException
265     {
266         serializer.startTag( NAMESPACE, tagName );
267         if ( documentMeta.getTitle() != null )
268         {
269             serializer.startTag( NAMESPACE, "title" ).text( documentMeta.getTitle() ).endTag( NAMESPACE, "title" );
270         }
271         if ( documentMeta.getAuthor() != null )
272         {
273             serializer.startTag( NAMESPACE, "author" ).text( documentMeta.getAuthor() ).endTag( NAMESPACE, "author" );
274         }
275         if ( ( documentMeta.getAuthors() != null ) && ( documentMeta.getAuthors().size() > 0 ) )
276         {
277             serializer.startTag( NAMESPACE, "authors" );
278             for ( Iterator iter = documentMeta.getAuthors().iterator(); iter.hasNext(); )
279             {
280                 DocumentAuthor o = (DocumentAuthor) iter.next();
281                 writeDocumentAuthor( o, "author", serializer );
282             }
283             serializer.endTag( NAMESPACE, "authors" );
284         }
285         if ( documentMeta.getSubject() != null )
286         {
287             serializer.startTag( NAMESPACE, "subject" ).text( documentMeta.getSubject() ).endTag( NAMESPACE, "subject" );
288         }
289         if ( documentMeta.getKeywords() != null )
290         {
291             serializer.startTag( NAMESPACE, "keywords" ).text( documentMeta.getKeywords() ).endTag( NAMESPACE, "keywords" );
292         }
293         if ( ( documentMeta.getKeyWords() != null ) && ( documentMeta.getKeyWords().size() > 0 ) )
294         {
295             serializer.startTag( NAMESPACE, "keyWords" );
296             for ( Iterator iter = documentMeta.getKeyWords().iterator(); iter.hasNext(); )
297             {
298                 String keyWord = (String) iter.next();
299                 serializer.startTag( NAMESPACE, "keyWord" ).text( keyWord ).endTag( NAMESPACE, "keyWord" );
300             }
301             serializer.endTag( NAMESPACE, "keyWords" );
302         }
303         if ( documentMeta.getPageSize() != null )
304         {
305             serializer.startTag( NAMESPACE, "pageSize" ).text( documentMeta.getPageSize() ).endTag( NAMESPACE, "pageSize" );
306         }
307         if ( documentMeta.getGenerator() != null )
308         {
309             serializer.startTag( NAMESPACE, "generator" ).text( documentMeta.getGenerator() ).endTag( NAMESPACE, "generator" );
310         }
311         if ( documentMeta.getDescription() != null )
312         {
313             serializer.startTag( NAMESPACE, "description" ).text( documentMeta.getDescription() ).endTag( NAMESPACE, "description" );
314         }
315         if ( documentMeta.getInitialCreator() != null )
316         {
317             serializer.startTag( NAMESPACE, "initialCreator" ).text( documentMeta.getInitialCreator() ).endTag( NAMESPACE, "initialCreator" );
318         }
319         if ( documentMeta.getCreator() != null )
320         {
321             serializer.startTag( NAMESPACE, "creator" ).text( documentMeta.getCreator() ).endTag( NAMESPACE, "creator" );
322         }
323         if ( documentMeta.getPrintedBy() != null )
324         {
325             serializer.startTag( NAMESPACE, "printedBy" ).text( documentMeta.getPrintedBy() ).endTag( NAMESPACE, "printedBy" );
326         }
327         if ( documentMeta.getCreationDate() != null )
328         {
329             serializer.startTag( NAMESPACE, "creationDate" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US ).format( documentMeta.getCreationDate() ) ).endTag( NAMESPACE, "creationDate" );
330         }
331         if ( documentMeta.getCreationdate() != null )
332         {
333             serializer.startTag( NAMESPACE, "creationdate" ).text( documentMeta.getCreationdate() ).endTag( NAMESPACE, "creationdate" );
334         }
335         if ( documentMeta.getDate() != null )
336         {
337             serializer.startTag( NAMESPACE, "date" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US ).format( documentMeta.getDate() ) ).endTag( NAMESPACE, "date" );
338         }
339         if ( documentMeta.getModifydate() != null )
340         {
341             serializer.startTag( NAMESPACE, "modifydate" ).text( documentMeta.getModifydate() ).endTag( NAMESPACE, "modifydate" );
342         }
343         if ( documentMeta.getPrintDate() != null )
344         {
345             serializer.startTag( NAMESPACE, "printDate" ).text( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US ).format( documentMeta.getPrintDate() ) ).endTag( NAMESPACE, "printDate" );
346         }
347         if ( documentMeta.getPrintdate() != null )
348         {
349             serializer.startTag( NAMESPACE, "printdate" ).text( documentMeta.getPrintdate() ).endTag( NAMESPACE, "printdate" );
350         }
351         if ( documentMeta.getTemplate() != null )
352         {
353             writeDocumentTemplate( (DocumentTemplate) documentMeta.getTemplate(), "template", serializer );
354         }
355         if ( documentMeta.getHyperlinkBehaviour() != null )
356         {
357             writeDocumentHyperlinkBehaviour( (DocumentHyperlinkBehaviour) documentMeta.getHyperlinkBehaviour(), "hyperlinkBehaviour", serializer );
358         }
359         if ( ( documentMeta.getLanguage() != null ) && !documentMeta.getLanguage().equals( "en-US" ) )
360         {
361             serializer.startTag( NAMESPACE, "language" ).text( documentMeta.getLanguage() ).endTag( NAMESPACE, "language" );
362         }
363         if ( documentMeta.getEditingCycles() != 0L )
364         {
365             serializer.startTag( NAMESPACE, "editingCycles" ).text( String.valueOf( documentMeta.getEditingCycles() ) ).endTag( NAMESPACE, "editingCycles" );
366         }
367         if ( documentMeta.getEditingDuration() != 0L )
368         {
369             serializer.startTag( NAMESPACE, "editingDuration" ).text( String.valueOf( documentMeta.getEditingDuration() ) ).endTag( NAMESPACE, "editingDuration" );
370         }
371         if ( documentMeta.getDocumentStatistic() != null )
372         {
373             writeDocumentStatistic( (DocumentStatistic) documentMeta.getDocumentStatistic(), "documentStatistic", serializer );
374         }
375         if ( documentMeta.isConfidential() != false )
376         {
377             serializer.startTag( NAMESPACE, "confidential" ).text( String.valueOf( documentMeta.isConfidential() ) ).endTag( NAMESPACE, "confidential" );
378         }
379         if ( documentMeta.isDraft() != false )
380         {
381             serializer.startTag( NAMESPACE, "draft" ).text( String.valueOf( documentMeta.isDraft() ) ).endTag( NAMESPACE, "draft" );
382         }
383         serializer.endTag( NAMESPACE, tagName );
384     } //-- void writeDocumentMeta( DocumentMeta, String, XmlSerializer )
385 
386     /**
387      * Method writeDocumentModel.
388      * 
389      * @param documentModel
390      * @param serializer
391      * @param tagName
392      * @throws java.io.IOException
393      */
394     private void writeDocumentModel( DocumentModel documentModel, String tagName, XmlSerializer serializer )
395         throws java.io.IOException
396     {
397         serializer.setPrefix( "", "http://maven.apache.org/DOCUMENT/1.0.1" );
398         serializer.startTag( NAMESPACE, tagName );
399         if ( documentModel.getOutputName() != null )
400         {
401             serializer.attribute( NAMESPACE, "outputName", documentModel.getOutputName() );
402         }
403         if ( documentModel.getMeta() != null )
404         {
405             writeDocumentMeta( (DocumentMeta) documentModel.getMeta(), "meta", serializer );
406         }
407         if ( documentModel.getToc() != null )
408         {
409             writeDocumentTOC( (DocumentTOC) documentModel.getToc(), "toc", serializer );
410         }
411         if ( documentModel.getCover() != null )
412         {
413             writeDocumentCover( (DocumentCover) documentModel.getCover(), "cover", serializer );
414         }
415         serializer.endTag( NAMESPACE, tagName );
416     } //-- void writeDocumentModel( DocumentModel, String, XmlSerializer )
417 
418     /**
419      * Method writeDocumentStatistic.
420      * 
421      * @param documentStatistic
422      * @param serializer
423      * @param tagName
424      * @throws java.io.IOException
425      */
426     private void writeDocumentStatistic( DocumentStatistic documentStatistic, String tagName, XmlSerializer serializer )
427         throws java.io.IOException
428     {
429         serializer.startTag( NAMESPACE, tagName );
430         if ( documentStatistic.getPageCount() != 0L )
431         {
432             serializer.attribute( NAMESPACE, "pageCount", String.valueOf( documentStatistic.getPageCount() ) );
433         }
434         if ( documentStatistic.getTableCount() != 0L )
435         {
436             serializer.attribute( NAMESPACE, "tableCount", String.valueOf( documentStatistic.getTableCount() ) );
437         }
438         if ( documentStatistic.getDrawCount() != 0L )
439         {
440             serializer.attribute( NAMESPACE, "drawCount", String.valueOf( documentStatistic.getDrawCount() ) );
441         }
442         if ( documentStatistic.getImageCount() != 0L )
443         {
444             serializer.attribute( NAMESPACE, "imageCount", String.valueOf( documentStatistic.getImageCount() ) );
445         }
446         if ( documentStatistic.getObjectCount() != 0L )
447         {
448             serializer.attribute( NAMESPACE, "objectCount", String.valueOf( documentStatistic.getObjectCount() ) );
449         }
450         if ( documentStatistic.getOleObjectCount() != 0L )
451         {
452             serializer.attribute( NAMESPACE, "oleObjectCount", String.valueOf( documentStatistic.getOleObjectCount() ) );
453         }
454         if ( documentStatistic.getParagraphCount() != 0L )
455         {
456             serializer.attribute( NAMESPACE, "paragraphCount", String.valueOf( documentStatistic.getParagraphCount() ) );
457         }
458         if ( documentStatistic.getWordCount() != 0L )
459         {
460             serializer.attribute( NAMESPACE, "wordCount", String.valueOf( documentStatistic.getWordCount() ) );
461         }
462         if ( documentStatistic.getCharacterCount() != 0L )
463         {
464             serializer.attribute( NAMESPACE, "characterCount", String.valueOf( documentStatistic.getCharacterCount() ) );
465         }
466         if ( documentStatistic.getRowCount() != 0L )
467         {
468             serializer.attribute( NAMESPACE, "rowCount", String.valueOf( documentStatistic.getRowCount() ) );
469         }
470         if ( documentStatistic.getFrameCount() != 0L )
471         {
472             serializer.attribute( NAMESPACE, "frameCount", String.valueOf( documentStatistic.getFrameCount() ) );
473         }
474         if ( documentStatistic.getSentenceCount() != 0L )
475         {
476             serializer.attribute( NAMESPACE, "sentenceCount", String.valueOf( documentStatistic.getSentenceCount() ) );
477         }
478         if ( documentStatistic.getSyllableCount() != 0L )
479         {
480             serializer.attribute( NAMESPACE, "syllableCount", String.valueOf( documentStatistic.getSyllableCount() ) );
481         }
482         if ( documentStatistic.getNonWhitespaceCharacterCount() != 0L )
483         {
484             serializer.attribute( NAMESPACE, "nonWhitespaceCharacterCount", String.valueOf( documentStatistic.getNonWhitespaceCharacterCount() ) );
485         }
486         serializer.endTag( NAMESPACE, tagName );
487     } //-- void writeDocumentStatistic( DocumentStatistic, String, XmlSerializer )
488 
489     /**
490      * Method writeDocumentTOC.
491      * 
492      * @param documentTOC
493      * @param serializer
494      * @param tagName
495      * @throws java.io.IOException
496      */
497     private void writeDocumentTOC( DocumentTOC documentTOC, String tagName, XmlSerializer serializer )
498         throws java.io.IOException
499     {
500         serializer.startTag( NAMESPACE, tagName );
501         if ( documentTOC.getName() != null )
502         {
503             serializer.attribute( NAMESPACE, "name", documentTOC.getName() );
504         }
505         if ( documentTOC.getDepth() != 0 )
506         {
507             serializer.attribute( NAMESPACE, "depth", String.valueOf( documentTOC.getDepth() ) );
508         }
509         if ( ( documentTOC.getItems() != null ) && ( documentTOC.getItems().size() > 0 ) )
510         {
511             for ( Iterator iter = documentTOC.getItems().iterator(); iter.hasNext(); )
512             {
513                 DocumentTOCItem o = (DocumentTOCItem) iter.next();
514                 writeDocumentTOCItem( o, "item", serializer );
515             }
516         }
517         serializer.endTag( NAMESPACE, tagName );
518     } //-- void writeDocumentTOC( DocumentTOC, String, XmlSerializer )
519 
520     /**
521      * Method writeDocumentTOCItem.
522      * 
523      * @param documentTOCItem
524      * @param serializer
525      * @param tagName
526      * @throws java.io.IOException
527      */
528     private void writeDocumentTOCItem( DocumentTOCItem documentTOCItem, String tagName, XmlSerializer serializer )
529         throws java.io.IOException
530     {
531         serializer.startTag( NAMESPACE, tagName );
532         if ( documentTOCItem.getName() != null )
533         {
534             serializer.attribute( NAMESPACE, "name", documentTOCItem.getName() );
535         }
536         if ( documentTOCItem.getRef() != null )
537         {
538             serializer.attribute( NAMESPACE, "ref", documentTOCItem.getRef() );
539         }
540         if ( documentTOCItem.isCollapse() != false )
541         {
542             serializer.attribute( NAMESPACE, "collapse", String.valueOf( documentTOCItem.isCollapse() ) );
543         }
544         if ( ( documentTOCItem.getItems() != null ) && ( documentTOCItem.getItems().size() > 0 ) )
545         {
546             for ( Iterator iter = documentTOCItem.getItems().iterator(); iter.hasNext(); )
547             {
548                 DocumentTOCItem o = (DocumentTOCItem) iter.next();
549                 writeDocumentTOCItem( o, "item", serializer );
550             }
551         }
552         serializer.endTag( NAMESPACE, tagName );
553     } //-- void writeDocumentTOCItem( DocumentTOCItem, String, XmlSerializer )
554 
555     /**
556      * Method writeDocumentTemplate.
557      * 
558      * @param documentTemplate
559      * @param serializer
560      * @param tagName
561      * @throws java.io.IOException
562      */
563     private void writeDocumentTemplate( DocumentTemplate documentTemplate, String tagName, XmlSerializer serializer )
564         throws java.io.IOException
565     {
566         serializer.startTag( NAMESPACE, tagName );
567         if ( documentTemplate.getHref() != null )
568         {
569             serializer.attribute( NAMESPACE, "href", documentTemplate.getHref() );
570         }
571         if ( documentTemplate.getTitle() != null )
572         {
573             serializer.attribute( NAMESPACE, "title", documentTemplate.getTitle() );
574         }
575         if ( documentTemplate.getDate() != null )
576         {
577             serializer.attribute( NAMESPACE, "date", new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US ).format( documentTemplate.getDate() ) );
578         }
579         if ( documentTemplate.getModifydate() != null )
580         {
581             serializer.attribute( NAMESPACE, "modifydate", documentTemplate.getModifydate() );
582         }
583         serializer.endTag( NAMESPACE, tagName );
584     } //-- void writeDocumentTemplate( DocumentTemplate, String, XmlSerializer )
585 
586 }