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