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