KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xml > serialize > XHTMLSerializer


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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
17
18 package org.apache.xml.serialize;
19
20
21 import java.io.OutputStream JavaDoc;
22 import java.io.Writer JavaDoc;
23
24
25 /**
26  * Implements an XHTML serializer supporting both DOM and SAX
27  * pretty serializing. For usage instructions see either {@link
28  * Serializer} or {@link BaseMarkupSerializer}.
29  *
30  * @deprecated This class was deprecated in Xerces 2.6.2. It is
31  * recommended that new applications use JAXP's Transformation API
32  * for XML (TrAX) for serializing XHTML. See the Xerces documentation
33  * for more information.
34  * @version $Revision: 1.12 $ $Date: 2004/09/06 22:57:13 $
35  * @author <a HREF="mailto:arkin@intalio.com">Assaf Arkin</a>
36  * @see Serializer
37  */

38 public class XHTMLSerializer
39     extends HTMLSerializer
40 {
41
42
43     /**
44      * Constructs a new serializer. The serializer cannot be used without
45      * calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
46      * first.
47      */

48     public XHTMLSerializer()
49     {
50         super( true, new OutputFormat( Method.XHTML, null, false ) );
51     }
52
53
54     /**
55      * Constructs a new serializer. The serializer cannot be used without
56      * calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
57      * first.
58      */

59     public XHTMLSerializer( OutputFormat format )
60     {
61         super( true, format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
62     }
63
64
65     /**
66      * Constructs a new serializer that writes to the specified writer
67      * using the specified output format. If <tt>format</tt> is null,
68      * will use a default output format.
69      *
70      * @param writer The writer to use
71      * @param format The output format to use, null for the default
72      */

73     public XHTMLSerializer( Writer JavaDoc writer, OutputFormat format )
74     {
75         super( true, format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
76         setOutputCharStream( writer );
77     }
78
79
80     /**
81      * Constructs a new serializer that writes to the specified output
82      * stream using the specified output format. If <tt>format</tt>
83      * is null, will use a default output format.
84      *
85      * @param output The output stream to use
86      * @param format The output format to use, null for the default
87      */

88     public XHTMLSerializer( OutputStream JavaDoc output, OutputFormat format )
89     {
90         super( true, format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
91         setOutputByteStream( output );
92     }
93
94
95     public void setOutputFormat( OutputFormat format )
96     {
97         super.setOutputFormat( format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
98     }
99
100
101 }
102
Popular Tags