01: /*
02: * Copyright 1999-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.jasig.portal.serialize;
18:
19: import java.io.OutputStream;
20: import java.io.Writer;
21:
22: /**
23: * Implements an XHTML serializer supporting both DOM and SAX
24: * pretty serializing. For usage instructions see either {@link
25: * Serializer} or {@link BaseMarkupSerializer}.
26: *
27: * @deprecated This class was deprecated in Xerces 2.6.2. It is
28: * recommended that new applications use JAXP's Transformation API
29: * for XML (TrAX) for serializing XHTML. See the Xerces documentation
30: * for more information.
31: * @version $Revision: 36559 $ $Date: 2006-04-28 11:38:13 -0700 (Fri, 28 Apr 2006) $
32: * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
33: * @see Serializer
34: */
35: public class XHTMLSerializer extends HTMLSerializer {
36:
37: /**
38: * Constructs a new serializer. The serializer cannot be used without
39: * calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
40: * first.
41: */
42: public XHTMLSerializer() {
43: super (true, new OutputFormat(Method.XHTML, null, false));
44: }
45:
46: /**
47: * Constructs a new serializer. The serializer cannot be used without
48: * calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
49: * first.
50: */
51: public XHTMLSerializer(OutputFormat format) {
52: super (true, format != null ? format : new OutputFormat(
53: Method.XHTML, null, false));
54: }
55:
56: /**
57: * Constructs a new serializer that writes to the specified writer
58: * using the specified output format. If <tt>format</tt> is null,
59: * will use a default output format.
60: *
61: * @param writer The writer to use
62: * @param format The output format to use, null for the default
63: */
64: public XHTMLSerializer(Writer writer, OutputFormat format) {
65: super (true, format != null ? format : new OutputFormat(
66: Method.XHTML, null, false));
67: setOutputCharStream(writer);
68: }
69:
70: /**
71: * Constructs a new serializer that writes to the specified output
72: * stream using the specified output format. If <tt>format</tt>
73: * is null, will use a default output format.
74: *
75: * @param output The output stream to use
76: * @param format The output format to use, null for the default
77: */
78: public XHTMLSerializer(OutputStream output, OutputFormat format) {
79: super (true, format != null ? format : new OutputFormat(
80: Method.XHTML, null, false));
81: setOutputByteStream(output);
82: }
83:
84: public void setOutputFormat(OutputFormat format) {
85: super .setOutputFormat(format != null ? format
86: : new OutputFormat(Method.XHTML, null, false));
87: }
88:
89: }
|