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.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
395         serializer.startTag( NAMESPACE, tagName );
396         serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/DOCUMENT/1.0.1 http://maven.apache.org/xsd/document-1.0.1.xsd" );
397         if ( documentModel.getOutputName() != null )
398         {
399             serializer.attribute( NAMESPACE, "outputName", documentModel.getOutputName() );
400         }
401         if ( documentModel.getMeta() != null )
402         {
403             writeDocumentMeta( (DocumentMeta) documentModel.getMeta(), "meta", serializer );
404         }
405         if ( documentModel.getToc() != null )
406         {
407             writeDocumentTOC( (DocumentTOC) documentModel.getToc(), "toc", serializer );
408         }
409         if ( documentModel.getCover() != null )
410         {
411             writeDocumentCover( (DocumentCover) documentModel.getCover(), "cover", serializer );
412         }
413         serializer.endTag( NAMESPACE, tagName );
414     } //-- void writeDocumentModel( DocumentModel, String, XmlSerializer )
415 
416     /**
417      * Method writeDocumentStatistic.
418      * 
419      * @param documentStatistic
420      * @param serializer
421      * @param tagName
422      * @throws java.io.IOException
423      */
424     private void writeDocumentStatistic( DocumentStatistic documentStatistic, String tagName, XmlSerializer serializer )
425         throws java.io.IOException
426     {
427         serializer.startTag( NAMESPACE, tagName );
428         if ( documentStatistic.getPageCount() != 0L )
429         {
430             serializer.attribute( NAMESPACE, "pageCount", String.valueOf( documentStatistic.getPageCount() ) );
431         }
432         if ( documentStatistic.getTableCount() != 0L )
433         {
434             serializer.attribute( NAMESPACE, "tableCount", String.valueOf( documentStatistic.getTableCount() ) );
435         }
436         if ( documentStatistic.getDrawCount() != 0L )
437         {
438             serializer.attribute( NAMESPACE, "drawCount", String.valueOf( documentStatistic.getDrawCount() ) );
439         }
440         if ( documentStatistic.getImageCount() != 0L )
441         {
442             serializer.attribute( NAMESPACE, "imageCount", String.valueOf( documentStatistic.getImageCount() ) );
443         }
444         if ( documentStatistic.getObjectCount() != 0L )
445         {
446             serializer.attribute( NAMESPACE, "objectCount", String.valueOf( documentStatistic.getObjectCount() ) );
447         }
448         if ( documentStatistic.getOleObjectCount() != 0L )
449         {
450             serializer.attribute( NAMESPACE, "oleObjectCount", String.valueOf( documentStatistic.getOleObjectCount() ) );
451         }
452         if ( documentStatistic.getParagraphCount() != 0L )
453         {
454             serializer.attribute( NAMESPACE, "paragraphCount", String.valueOf( documentStatistic.getParagraphCount() ) );
455         }
456         if ( documentStatistic.getWordCount() != 0L )
457         {
458             serializer.attribute( NAMESPACE, "wordCount", String.valueOf( documentStatistic.getWordCount() ) );
459         }
460         if ( documentStatistic.getCharacterCount() != 0L )
461         {
462             serializer.attribute( NAMESPACE, "characterCount", String.valueOf( documentStatistic.getCharacterCount() ) );
463         }
464         if ( documentStatistic.getRowCount() != 0L )
465         {
466             serializer.attribute( NAMESPACE, "rowCount", String.valueOf( documentStatistic.getRowCount() ) );
467         }
468         if ( documentStatistic.getFrameCount() != 0L )
469         {
470             serializer.attribute( NAMESPACE, "frameCount", String.valueOf( documentStatistic.getFrameCount() ) );
471         }
472         if ( documentStatistic.getSentenceCount() != 0L )
473         {
474             serializer.attribute( NAMESPACE, "sentenceCount", String.valueOf( documentStatistic.getSentenceCount() ) );
475         }
476         if ( documentStatistic.getSyllableCount() != 0L )
477         {
478             serializer.attribute( NAMESPACE, "syllableCount", String.valueOf( documentStatistic.getSyllableCount() ) );
479         }
480         if ( documentStatistic.getNonWhitespaceCharacterCount() != 0L )
481         {
482             serializer.attribute( NAMESPACE, "nonWhitespaceCharacterCount", String.valueOf( documentStatistic.getNonWhitespaceCharacterCount() ) );
483         }
484         serializer.endTag( NAMESPACE, tagName );
485     } //-- void writeDocumentStatistic( DocumentStatistic, String, XmlSerializer )
486 
487     /**
488      * Method writeDocumentTOC.
489      * 
490      * @param documentTOC
491      * @param serializer
492      * @param tagName
493      * @throws java.io.IOException
494      */
495     private void writeDocumentTOC( DocumentTOC documentTOC, String tagName, XmlSerializer serializer )
496         throws java.io.IOException
497     {
498         serializer.startTag( NAMESPACE, tagName );
499         if ( documentTOC.getName() != null )
500         {
501             serializer.attribute( NAMESPACE, "name", documentTOC.getName() );
502         }
503         if ( documentTOC.getDepth() != 0 )
504         {
505             serializer.attribute( NAMESPACE, "depth", String.valueOf( documentTOC.getDepth() ) );
506         }
507         if ( ( documentTOC.getItems() != null ) && ( documentTOC.getItems().size() > 0 ) )
508         {
509             for ( Iterator iter = documentTOC.getItems().iterator(); iter.hasNext(); )
510             {
511                 DocumentTOCItem o = (DocumentTOCItem) iter.next();
512                 writeDocumentTOCItem( o, "item", serializer );
513             }
514         }
515         serializer.endTag( NAMESPACE, tagName );
516     } //-- void writeDocumentTOC( DocumentTOC, String, XmlSerializer )
517 
518     /**
519      * Method writeDocumentTOCItem.
520      * 
521      * @param documentTOCItem
522      * @param serializer
523      * @param tagName
524      * @throws java.io.IOException
525      */
526     private void writeDocumentTOCItem( DocumentTOCItem documentTOCItem, String tagName, XmlSerializer serializer )
527         throws java.io.IOException
528     {
529         serializer.startTag( NAMESPACE, tagName );
530         if ( documentTOCItem.getName() != null )
531         {
532             serializer.attribute( NAMESPACE, "name", documentTOCItem.getName() );
533         }
534         if ( documentTOCItem.getRef() != null )
535         {
536             serializer.attribute( NAMESPACE, "ref", documentTOCItem.getRef() );
537         }
538         if ( documentTOCItem.isCollapse() != false )
539         {
540             serializer.attribute( NAMESPACE, "collapse", String.valueOf( documentTOCItem.isCollapse() ) );
541         }
542         if ( ( documentTOCItem.getItems() != null ) && ( documentTOCItem.getItems().size() > 0 ) )
543         {
544             for ( Iterator iter = documentTOCItem.getItems().iterator(); iter.hasNext(); )
545             {
546                 DocumentTOCItem o = (DocumentTOCItem) iter.next();
547                 writeDocumentTOCItem( o, "item", serializer );
548             }
549         }
550         serializer.endTag( NAMESPACE, tagName );
551     } //-- void writeDocumentTOCItem( DocumentTOCItem, String, XmlSerializer )
552 
553     /**
554      * Method writeDocumentTemplate.
555      * 
556      * @param documentTemplate
557      * @param serializer
558      * @param tagName
559      * @throws java.io.IOException
560      */
561     private void writeDocumentTemplate( DocumentTemplate documentTemplate, String tagName, XmlSerializer serializer )
562         throws java.io.IOException
563     {
564         serializer.startTag( NAMESPACE, tagName );
565         if ( documentTemplate.getHref() != null )
566         {
567             serializer.attribute( NAMESPACE, "href", documentTemplate.getHref() );
568         }
569         if ( documentTemplate.getTitle() != null )
570         {
571             serializer.attribute( NAMESPACE, "title", documentTemplate.getTitle() );
572         }
573         if ( documentTemplate.getDate() != null )
574         {
575             serializer.attribute( NAMESPACE, "date", new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( documentTemplate.getDate() ) );
576         }
577         if ( documentTemplate.getModifydate() != null )
578         {
579             serializer.attribute( NAMESPACE, "modifydate", documentTemplate.getModifydate() );
580         }
581         serializer.endTag( NAMESPACE, tagName );
582     } //-- void writeDocumentTemplate( DocumentTemplate, String, XmlSerializer )
583 
584 }