Coverage Report - org.apache.maven.doxia.document.io.xpp3.DocumentXpp3Writer
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentXpp3Writer
93%
218/233
51%
98/190
9,636
 
 1  
 /*
 2  
  =================== DO NOT EDIT THIS FILE ====================
 3  
  Generated by Modello 1.4.1 on 2012-04-13 21:33:05,
 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  2
 public class DocumentXpp3Writer
 38  
 {
 39  
 
 40  
       //--------------------------/
 41  
      //- Class/Member Variables -/
 42  
     //--------------------------/
 43  
 
 44  
     /**
 45  
      * Field NAMESPACE.
 46  
      */
 47  2
     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  2
         XmlSerializer serializer = new MXSerializer();
 65  2
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
 66  2
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
 67  2
         serializer.setOutput( writer );
 68  2
         serializer.startDocument( documentModel.getModelEncoding(), null );
 69  2
         writeDocumentModel( documentModel, "document", serializer );
 70  2
         serializer.endDocument();
 71  2
     } //-- 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  0
         XmlSerializer serializer = new MXSerializer();
 84  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
 85  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
 86  0
         serializer.setOutput( stream, documentModel.getModelEncoding() );
 87  0
         serializer.startDocument( documentModel.getModelEncoding(), null );
 88  0
         writeDocumentModel( documentModel, "document", serializer );
 89  0
         serializer.endDocument();
 90  0
     } //-- 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  4
         serializer.startTag( NAMESPACE, tagName );
 104  4
         if ( documentAuthor.getFirstName() != null )
 105  
         {
 106  4
             serializer.startTag( NAMESPACE, "firstName" ).text( documentAuthor.getFirstName() ).endTag( NAMESPACE, "firstName" );
 107  
         }
 108  4
         if ( documentAuthor.getLastName() != null )
 109  
         {
 110  4
             serializer.startTag( NAMESPACE, "lastName" ).text( documentAuthor.getLastName() ).endTag( NAMESPACE, "lastName" );
 111  
         }
 112  4
         if ( documentAuthor.getName() != null )
 113  
         {
 114  4
             serializer.startTag( NAMESPACE, "name" ).text( documentAuthor.getName() ).endTag( NAMESPACE, "name" );
 115  
         }
 116  4
         if ( documentAuthor.getInitials() != null )
 117  
         {
 118  4
             serializer.startTag( NAMESPACE, "initials" ).text( documentAuthor.getInitials() ).endTag( NAMESPACE, "initials" );
 119  
         }
 120  4
         if ( documentAuthor.getTitle() != null )
 121  
         {
 122  4
             serializer.startTag( NAMESPACE, "title" ).text( documentAuthor.getTitle() ).endTag( NAMESPACE, "title" );
 123  
         }
 124  4
         if ( documentAuthor.getPosition() != null )
 125  
         {
 126  4
             serializer.startTag( NAMESPACE, "position" ).text( documentAuthor.getPosition() ).endTag( NAMESPACE, "position" );
 127  
         }
 128  4
         if ( documentAuthor.getEmail() != null )
 129  
         {
 130  4
             serializer.startTag( NAMESPACE, "email" ).text( documentAuthor.getEmail() ).endTag( NAMESPACE, "email" );
 131  
         }
 132  4
         if ( documentAuthor.getPhoneNumber() != null )
 133  
         {
 134  4
             serializer.startTag( NAMESPACE, "phoneNumber" ).text( documentAuthor.getPhoneNumber() ).endTag( NAMESPACE, "phoneNumber" );
 135  
         }
 136  4
         if ( documentAuthor.getFaxNumber() != null )
 137  
         {
 138  4
             serializer.startTag( NAMESPACE, "faxNumber" ).text( documentAuthor.getFaxNumber() ).endTag( NAMESPACE, "faxNumber" );
 139  
         }
 140  4
         if ( documentAuthor.getCompanyName() != null )
 141  
         {
 142  4
             serializer.startTag( NAMESPACE, "companyName" ).text( documentAuthor.getCompanyName() ).endTag( NAMESPACE, "companyName" );
 143  
         }
 144  4
         if ( documentAuthor.getStreet() != null )
 145  
         {
 146  4
             serializer.startTag( NAMESPACE, "street" ).text( documentAuthor.getStreet() ).endTag( NAMESPACE, "street" );
 147  
         }
 148  4
         if ( documentAuthor.getCity() != null )
 149  
         {
 150  4
             serializer.startTag( NAMESPACE, "city" ).text( documentAuthor.getCity() ).endTag( NAMESPACE, "city" );
 151  
         }
 152  4
         if ( documentAuthor.getPostalCode() != null )
 153  
         {
 154  4
             serializer.startTag( NAMESPACE, "postalCode" ).text( documentAuthor.getPostalCode() ).endTag( NAMESPACE, "postalCode" );
 155  
         }
 156  4
         if ( documentAuthor.getCountry() != null )
 157  
         {
 158  4
             serializer.startTag( NAMESPACE, "country" ).text( documentAuthor.getCountry() ).endTag( NAMESPACE, "country" );
 159  
         }
 160  4
         if ( documentAuthor.getState() != null )
 161  
         {
 162  4
             serializer.startTag( NAMESPACE, "state" ).text( documentAuthor.getState() ).endTag( NAMESPACE, "state" );
 163  
         }
 164  4
         serializer.endTag( NAMESPACE, tagName );
 165  4
     } //-- 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  2
         serializer.startTag( NAMESPACE, tagName );
 179  2
         if ( documentCover.getCoverTitle() != null )
 180  
         {
 181  2
             serializer.startTag( NAMESPACE, "coverTitle" ).text( documentCover.getCoverTitle() ).endTag( NAMESPACE, "coverTitle" );
 182  
         }
 183  2
         if ( documentCover.getCoverSubTitle() != null )
 184  
         {
 185  2
             serializer.startTag( NAMESPACE, "coverSubTitle" ).text( documentCover.getCoverSubTitle() ).endTag( NAMESPACE, "coverSubTitle" );
 186  
         }
 187  2
         if ( documentCover.getCoverVersion() != null )
 188  
         {
 189  2
             serializer.startTag( NAMESPACE, "coverVersion" ).text( documentCover.getCoverVersion() ).endTag( NAMESPACE, "coverVersion" );
 190  
         }
 191  2
         if ( documentCover.getCoverType() != null )
 192  
         {
 193  2
             serializer.startTag( NAMESPACE, "coverType" ).text( documentCover.getCoverType() ).endTag( NAMESPACE, "coverType" );
 194  
         }
 195  2
         if ( documentCover.getCoverDate() != null )
 196  
         {
 197  2
             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  2
         if ( documentCover.getCoverdate() != null )
 200  
         {
 201  2
             serializer.startTag( NAMESPACE, "coverdate" ).text( documentCover.getCoverdate() ).endTag( NAMESPACE, "coverdate" );
 202  
         }
 203  2
         if ( ( documentCover.getAuthors() != null ) && ( documentCover.getAuthors().size() > 0 ) )
 204  
         {
 205  2
             serializer.startTag( NAMESPACE, "authors" );
 206  2
             for ( Iterator iter = documentCover.getAuthors().iterator(); iter.hasNext(); )
 207  
             {
 208  2
                 DocumentAuthor o = (DocumentAuthor) iter.next();
 209  2
                 writeDocumentAuthor( o, "author", serializer );
 210  2
             }
 211  2
             serializer.endTag( NAMESPACE, "authors" );
 212  
         }
 213  2
         if ( documentCover.getAuthor() != null )
 214  
         {
 215  2
             serializer.startTag( NAMESPACE, "author" ).text( documentCover.getAuthor() ).endTag( NAMESPACE, "author" );
 216  
         }
 217  2
         if ( documentCover.getProjectName() != null )
 218  
         {
 219  2
             serializer.startTag( NAMESPACE, "projectName" ).text( documentCover.getProjectName() ).endTag( NAMESPACE, "projectName" );
 220  
         }
 221  2
         if ( documentCover.getProjectLogo() != null )
 222  
         {
 223  2
             serializer.startTag( NAMESPACE, "projectLogo" ).text( documentCover.getProjectLogo() ).endTag( NAMESPACE, "projectLogo" );
 224  
         }
 225  2
         if ( documentCover.getCompanyName() != null )
 226  
         {
 227  2
             serializer.startTag( NAMESPACE, "companyName" ).text( documentCover.getCompanyName() ).endTag( NAMESPACE, "companyName" );
 228  
         }
 229  2
         if ( documentCover.getCompanyLogo() != null )
 230  
         {
 231  2
             serializer.startTag( NAMESPACE, "companyLogo" ).text( documentCover.getCompanyLogo() ).endTag( NAMESPACE, "companyLogo" );
 232  
         }
 233  2
         serializer.endTag( NAMESPACE, tagName );
 234  2
     } //-- 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  2
         serializer.startTag( NAMESPACE, tagName );
 248  2
         if ( ( documentHyperlinkBehaviour.getTargetFrame() != null ) && !documentHyperlinkBehaviour.getTargetFrame().equals( "_self" ) )
 249  
         {
 250  2
             serializer.attribute( NAMESPACE, "targetFrame", documentHyperlinkBehaviour.getTargetFrame() );
 251  
         }
 252  2
         serializer.endTag( NAMESPACE, tagName );
 253  2
     } //-- 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  2
         serializer.startTag( NAMESPACE, tagName );
 267  2
         if ( documentMeta.getTitle() != null )
 268  
         {
 269  2
             serializer.startTag( NAMESPACE, "title" ).text( documentMeta.getTitle() ).endTag( NAMESPACE, "title" );
 270  
         }
 271  2
         if ( documentMeta.getAuthor() != null )
 272  
         {
 273  2
             serializer.startTag( NAMESPACE, "author" ).text( documentMeta.getAuthor() ).endTag( NAMESPACE, "author" );
 274  
         }
 275  2
         if ( ( documentMeta.getAuthors() != null ) && ( documentMeta.getAuthors().size() > 0 ) )
 276  
         {
 277  2
             serializer.startTag( NAMESPACE, "authors" );
 278  2
             for ( Iterator iter = documentMeta.getAuthors().iterator(); iter.hasNext(); )
 279  
             {
 280  2
                 DocumentAuthor o = (DocumentAuthor) iter.next();
 281  2
                 writeDocumentAuthor( o, "author", serializer );
 282  2
             }
 283  2
             serializer.endTag( NAMESPACE, "authors" );
 284  
         }
 285  2
         if ( documentMeta.getSubject() != null )
 286  
         {
 287  2
             serializer.startTag( NAMESPACE, "subject" ).text( documentMeta.getSubject() ).endTag( NAMESPACE, "subject" );
 288  
         }
 289  2
         if ( documentMeta.getKeywords() != null )
 290  
         {
 291  0
             serializer.startTag( NAMESPACE, "keywords" ).text( documentMeta.getKeywords() ).endTag( NAMESPACE, "keywords" );
 292  
         }
 293  2
         if ( ( documentMeta.getKeyWords() != null ) && ( documentMeta.getKeyWords().size() > 0 ) )
 294  
         {
 295  2
             serializer.startTag( NAMESPACE, "keyWords" );
 296  2
             for ( Iterator iter = documentMeta.getKeyWords().iterator(); iter.hasNext(); )
 297  
             {
 298  4
                 String keyWord = (String) iter.next();
 299  4
                 serializer.startTag( NAMESPACE, "keyWord" ).text( keyWord ).endTag( NAMESPACE, "keyWord" );
 300  4
             }
 301  2
             serializer.endTag( NAMESPACE, "keyWords" );
 302  
         }
 303  2
         if ( documentMeta.getPageSize() != null )
 304  
         {
 305  2
             serializer.startTag( NAMESPACE, "pageSize" ).text( documentMeta.getPageSize() ).endTag( NAMESPACE, "pageSize" );
 306  
         }
 307  2
         if ( documentMeta.getGenerator() != null )
 308  
         {
 309  2
             serializer.startTag( NAMESPACE, "generator" ).text( documentMeta.getGenerator() ).endTag( NAMESPACE, "generator" );
 310  
         }
 311  2
         if ( documentMeta.getDescription() != null )
 312  
         {
 313  2
             serializer.startTag( NAMESPACE, "description" ).text( documentMeta.getDescription() ).endTag( NAMESPACE, "description" );
 314  
         }
 315  2
         if ( documentMeta.getInitialCreator() != null )
 316  
         {
 317  2
             serializer.startTag( NAMESPACE, "initialCreator" ).text( documentMeta.getInitialCreator() ).endTag( NAMESPACE, "initialCreator" );
 318  
         }
 319  2
         if ( documentMeta.getCreator() != null )
 320  
         {
 321  2
             serializer.startTag( NAMESPACE, "creator" ).text( documentMeta.getCreator() ).endTag( NAMESPACE, "creator" );
 322  
         }
 323  2
         if ( documentMeta.getPrintedBy() != null )
 324  
         {
 325  2
             serializer.startTag( NAMESPACE, "printedBy" ).text( documentMeta.getPrintedBy() ).endTag( NAMESPACE, "printedBy" );
 326  
         }
 327  2
         if ( documentMeta.getCreationDate() != null )
 328  
         {
 329  2
             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  2
         if ( documentMeta.getCreationdate() != null )
 332  
         {
 333  2
             serializer.startTag( NAMESPACE, "creationdate" ).text( documentMeta.getCreationdate() ).endTag( NAMESPACE, "creationdate" );
 334  
         }
 335  2
         if ( documentMeta.getDate() != null )
 336  
         {
 337  2
             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  2
         if ( documentMeta.getModifydate() != null )
 340  
         {
 341  2
             serializer.startTag( NAMESPACE, "modifydate" ).text( documentMeta.getModifydate() ).endTag( NAMESPACE, "modifydate" );
 342  
         }
 343  2
         if ( documentMeta.getPrintDate() != null )
 344  
         {
 345  2
             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  2
         if ( documentMeta.getPrintdate() != null )
 348  
         {
 349  2
             serializer.startTag( NAMESPACE, "printdate" ).text( documentMeta.getPrintdate() ).endTag( NAMESPACE, "printdate" );
 350  
         }
 351  2
         if ( documentMeta.getTemplate() != null )
 352  
         {
 353  2
             writeDocumentTemplate( (DocumentTemplate) documentMeta.getTemplate(), "template", serializer );
 354  
         }
 355  2
         if ( documentMeta.getHyperlinkBehaviour() != null )
 356  
         {
 357  2
             writeDocumentHyperlinkBehaviour( (DocumentHyperlinkBehaviour) documentMeta.getHyperlinkBehaviour(), "hyperlinkBehaviour", serializer );
 358  
         }
 359  2
         if ( ( documentMeta.getLanguage() != null ) && !documentMeta.getLanguage().equals( "en-US" ) )
 360  
         {
 361  2
             serializer.startTag( NAMESPACE, "language" ).text( documentMeta.getLanguage() ).endTag( NAMESPACE, "language" );
 362  
         }
 363  2
         if ( documentMeta.getEditingCycles() != 0L )
 364  
         {
 365  2
             serializer.startTag( NAMESPACE, "editingCycles" ).text( String.valueOf( documentMeta.getEditingCycles() ) ).endTag( NAMESPACE, "editingCycles" );
 366  
         }
 367  2
         if ( documentMeta.getEditingDuration() != 0L )
 368  
         {
 369  2
             serializer.startTag( NAMESPACE, "editingDuration" ).text( String.valueOf( documentMeta.getEditingDuration() ) ).endTag( NAMESPACE, "editingDuration" );
 370  
         }
 371  2
         if ( documentMeta.getDocumentStatistic() != null )
 372  
         {
 373  2
             writeDocumentStatistic( (DocumentStatistic) documentMeta.getDocumentStatistic(), "documentStatistic", serializer );
 374  
         }
 375  2
         if ( documentMeta.isConfidential() != false )
 376  
         {
 377  2
             serializer.startTag( NAMESPACE, "confidential" ).text( String.valueOf( documentMeta.isConfidential() ) ).endTag( NAMESPACE, "confidential" );
 378  
         }
 379  2
         if ( documentMeta.isDraft() != false )
 380  
         {
 381  2
             serializer.startTag( NAMESPACE, "draft" ).text( String.valueOf( documentMeta.isDraft() ) ).endTag( NAMESPACE, "draft" );
 382  
         }
 383  2
         serializer.endTag( NAMESPACE, tagName );
 384  2
     } //-- 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  2
         serializer.setPrefix( "", "http://maven.apache.org/DOCUMENT/1.0.1" );
 398  2
         serializer.startTag( NAMESPACE, tagName );
 399  2
         if ( documentModel.getOutputName() != null )
 400  
         {
 401  2
             serializer.attribute( NAMESPACE, "outputName", documentModel.getOutputName() );
 402  
         }
 403  2
         if ( documentModel.getMeta() != null )
 404  
         {
 405  2
             writeDocumentMeta( (DocumentMeta) documentModel.getMeta(), "meta", serializer );
 406  
         }
 407  2
         if ( documentModel.getToc() != null )
 408  
         {
 409  2
             writeDocumentTOC( (DocumentTOC) documentModel.getToc(), "toc", serializer );
 410  
         }
 411  2
         if ( documentModel.getCover() != null )
 412  
         {
 413  2
             writeDocumentCover( (DocumentCover) documentModel.getCover(), "cover", serializer );
 414  
         }
 415  2
         serializer.endTag( NAMESPACE, tagName );
 416  2
     } //-- 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  2
         serializer.startTag( NAMESPACE, tagName );
 430  2
         if ( documentStatistic.getPageCount() != 0L )
 431  
         {
 432  2
             serializer.attribute( NAMESPACE, "pageCount", String.valueOf( documentStatistic.getPageCount() ) );
 433  
         }
 434  2
         if ( documentStatistic.getTableCount() != 0L )
 435  
         {
 436  2
             serializer.attribute( NAMESPACE, "tableCount", String.valueOf( documentStatistic.getTableCount() ) );
 437  
         }
 438  2
         if ( documentStatistic.getDrawCount() != 0L )
 439  
         {
 440  2
             serializer.attribute( NAMESPACE, "drawCount", String.valueOf( documentStatistic.getDrawCount() ) );
 441  
         }
 442  2
         if ( documentStatistic.getImageCount() != 0L )
 443  
         {
 444  2
             serializer.attribute( NAMESPACE, "imageCount", String.valueOf( documentStatistic.getImageCount() ) );
 445  
         }
 446  2
         if ( documentStatistic.getObjectCount() != 0L )
 447  
         {
 448  2
             serializer.attribute( NAMESPACE, "objectCount", String.valueOf( documentStatistic.getObjectCount() ) );
 449  
         }
 450  2
         if ( documentStatistic.getOleObjectCount() != 0L )
 451  
         {
 452  2
             serializer.attribute( NAMESPACE, "oleObjectCount", String.valueOf( documentStatistic.getOleObjectCount() ) );
 453  
         }
 454  2
         if ( documentStatistic.getParagraphCount() != 0L )
 455  
         {
 456  2
             serializer.attribute( NAMESPACE, "paragraphCount", String.valueOf( documentStatistic.getParagraphCount() ) );
 457  
         }
 458  2
         if ( documentStatistic.getWordCount() != 0L )
 459  
         {
 460  2
             serializer.attribute( NAMESPACE, "wordCount", String.valueOf( documentStatistic.getWordCount() ) );
 461  
         }
 462  2
         if ( documentStatistic.getCharacterCount() != 0L )
 463  
         {
 464  2
             serializer.attribute( NAMESPACE, "characterCount", String.valueOf( documentStatistic.getCharacterCount() ) );
 465  
         }
 466  2
         if ( documentStatistic.getRowCount() != 0L )
 467  
         {
 468  2
             serializer.attribute( NAMESPACE, "rowCount", String.valueOf( documentStatistic.getRowCount() ) );
 469  
         }
 470  2
         if ( documentStatistic.getFrameCount() != 0L )
 471  
         {
 472  2
             serializer.attribute( NAMESPACE, "frameCount", String.valueOf( documentStatistic.getFrameCount() ) );
 473  
         }
 474  2
         if ( documentStatistic.getSentenceCount() != 0L )
 475  
         {
 476  2
             serializer.attribute( NAMESPACE, "sentenceCount", String.valueOf( documentStatistic.getSentenceCount() ) );
 477  
         }
 478  2
         if ( documentStatistic.getSyllableCount() != 0L )
 479  
         {
 480  2
             serializer.attribute( NAMESPACE, "syllableCount", String.valueOf( documentStatistic.getSyllableCount() ) );
 481  
         }
 482  2
         if ( documentStatistic.getNonWhitespaceCharacterCount() != 0L )
 483  
         {
 484  2
             serializer.attribute( NAMESPACE, "nonWhitespaceCharacterCount", String.valueOf( documentStatistic.getNonWhitespaceCharacterCount() ) );
 485  
         }
 486  2
         serializer.endTag( NAMESPACE, tagName );
 487  2
     } //-- 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  2
         serializer.startTag( NAMESPACE, tagName );
 501  2
         if ( documentTOC.getName() != null )
 502  
         {
 503  2
             serializer.attribute( NAMESPACE, "name", documentTOC.getName() );
 504  
         }
 505  2
         if ( documentTOC.getDepth() != 0 )
 506  
         {
 507  0
             serializer.attribute( NAMESPACE, "depth", String.valueOf( documentTOC.getDepth() ) );
 508  
         }
 509  2
         if ( ( documentTOC.getItems() != null ) && ( documentTOC.getItems().size() > 0 ) )
 510  
         {
 511  2
             for ( Iterator iter = documentTOC.getItems().iterator(); iter.hasNext(); )
 512  
             {
 513  4
                 DocumentTOCItem o = (DocumentTOCItem) iter.next();
 514  4
                 writeDocumentTOCItem( o, "item", serializer );
 515  4
             }
 516  
         }
 517  2
         serializer.endTag( NAMESPACE, tagName );
 518  2
     } //-- 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  4
         serializer.startTag( NAMESPACE, tagName );
 532  4
         if ( documentTOCItem.getName() != null )
 533  
         {
 534  4
             serializer.attribute( NAMESPACE, "name", documentTOCItem.getName() );
 535  
         }
 536  4
         if ( documentTOCItem.getRef() != null )
 537  
         {
 538  4
             serializer.attribute( NAMESPACE, "ref", documentTOCItem.getRef() );
 539  
         }
 540  4
         if ( documentTOCItem.isCollapse() != false )
 541  
         {
 542  0
             serializer.attribute( NAMESPACE, "collapse", String.valueOf( documentTOCItem.isCollapse() ) );
 543  
         }
 544  4
         if ( ( documentTOCItem.getItems() != null ) && ( documentTOCItem.getItems().size() > 0 ) )
 545  
         {
 546  0
             for ( Iterator iter = documentTOCItem.getItems().iterator(); iter.hasNext(); )
 547  
             {
 548  0
                 DocumentTOCItem o = (DocumentTOCItem) iter.next();
 549  0
                 writeDocumentTOCItem( o, "item", serializer );
 550  0
             }
 551  
         }
 552  4
         serializer.endTag( NAMESPACE, tagName );
 553  4
     } //-- 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  2
         serializer.startTag( NAMESPACE, tagName );
 567  2
         if ( documentTemplate.getHref() != null )
 568  
         {
 569  2
             serializer.attribute( NAMESPACE, "href", documentTemplate.getHref() );
 570  
         }
 571  2
         if ( documentTemplate.getTitle() != null )
 572  
         {
 573  2
             serializer.attribute( NAMESPACE, "title", documentTemplate.getTitle() );
 574  
         }
 575  2
         if ( documentTemplate.getDate() != null )
 576  
         {
 577  2
             serializer.attribute( NAMESPACE, "date", new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US ).format( documentTemplate.getDate() ) );
 578  
         }
 579  2
         if ( documentTemplate.getModifydate() != null )
 580  
         {
 581  2
             serializer.attribute( NAMESPACE, "modifydate", documentTemplate.getModifydate() );
 582  
         }
 583  2
         serializer.endTag( NAMESPACE, tagName );
 584  2
     } //-- void writeDocumentTemplate( DocumentTemplate, String, XmlSerializer )
 585  
 
 586  
 }