View Javadoc
1   /*
2    * Copyright 2005 Werner Guttmann
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.exolab.castor.xml;
17  
18  /**
19   * Output format contract for XML serialization.
20   * @author Werner Guttmann
21   */
22  public interface OutputFormat {
23      
24      /**
25       * Default serialization method, being XML 
26       */
27      public static final String XML = "xml";
28  
29      /**
30       * Set serialization method.
31       * @param method Required serialization method.
32       */
33      void setMethod(String method);
34      
35      /**
36       * Specify whether indentation is required
37       * @param indent true if XML output should be intended.
38       */
39      void setIndenting(boolean indent);
40      
41      /**
42       * Indicate whether white space should be preserved.
43       * @param preserveSpace True if white space should be preserved
44       */
45      void setPreserveSpace(boolean preserveSpace); 
46      
47      /**
48       * Returns the (underlying) OutputFormat instance
49       * @return the (underlying) OutputFormat instance
50       */
51      Object getFormat();
52  
53      /**
54       * Defines the doc types to use.
55       * @param type1 Public DOC type.
56       * @param type2 System doc type.
57       */
58      void setDoctype (String type1, String type2);
59      
60      /**
61       * Indicates whether to omit XML declaration.
62       * @param omitXMLDeclaration True if XMl declaration should be omitted.
63       */
64      void setOmitXMLDeclaration (boolean omitXMLDeclaration);
65      
66      /**
67       * Indicates whether to omit DOCTYPE definition.
68       * @param omitDocumentType True if DOCTYPE definition should be omitted.
69       */
70      void setOmitDocumentType (boolean omitDocumentType);
71      
72      /**
73       * Sets the encoding to use.
74       * @param encoding The encoding to use.
75       */
76      void setEncoding(String encoding);
77      
78      /**
79       * Defines the XML document version to be output.
80       * @param encoding The XML document version to be used.
81       * 
82       * @since 1.3.2 
83       */
84      void setVersion(String version);
85      
86  }