01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.xml.serialize;
19:
20: import java.io.OutputStream;
21: import java.io.Writer;
22:
23: /**
24: * Implements an XHTML serializer supporting both DOM and SAX
25: * pretty serializing. For usage instructions see either {@link
26: * Serializer} or {@link BaseMarkupSerializer}.
27: *
28: * @deprecated This class was deprecated in Xerces 2.6.2. It is
29: * recommended that new applications use JAXP's Transformation API
30: * for XML (TrAX) for serializing XHTML. See the Xerces documentation
31: * for more information.
32: * @version $Revision: 447253 $ $Date: 2006-09-18 01:32:50 -0400 (Mon, 18 Sep 2006) $
33: * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
34: * @see Serializer
35: */
36: public class XHTMLSerializer extends HTMLSerializer {
37:
38: /**
39: * Constructs a new serializer. The serializer cannot be used without
40: * calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
41: * first.
42: */
43: public XHTMLSerializer() {
44: super (true, new OutputFormat(Method.XHTML, null, false));
45: }
46:
47: /**
48: * Constructs a new serializer. The serializer cannot be used without
49: * calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
50: * first.
51: */
52: public XHTMLSerializer(OutputFormat format) {
53: super (true, format != null ? format : new OutputFormat(
54: Method.XHTML, null, false));
55: }
56:
57: /**
58: * Constructs a new serializer that writes to the specified writer
59: * using the specified output format. If <tt>format</tt> is null,
60: * will use a default output format.
61: *
62: * @param writer The writer to use
63: * @param format The output format to use, null for the default
64: */
65: public XHTMLSerializer(Writer writer, OutputFormat format) {
66: super (true, format != null ? format : new OutputFormat(
67: Method.XHTML, null, false));
68: setOutputCharStream(writer);
69: }
70:
71: /**
72: * Constructs a new serializer that writes to the specified output
73: * stream using the specified output format. If <tt>format</tt>
74: * is null, will use a default output format.
75: *
76: * @param output The output stream to use
77: * @param format The output format to use, null for the default
78: */
79: public XHTMLSerializer(OutputStream output, OutputFormat format) {
80: super (true, format != null ? format : new OutputFormat(
81: Method.XHTML, null, false));
82: setOutputByteStream(output);
83: }
84:
85: public void setOutputFormat(OutputFormat format) {
86: super .setOutputFormat(format != null ? format
87: : new OutputFormat(Method.XHTML, null, false));
88: }
89:
90: }
|