1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 
  22 package com.sun.org.apache.xml.internal.serialize;
  23 
  24 
  25 import java.io.OutputStream;
  26 import java.io.Writer;
  27 
  28 
  29 /**
  30  * Implements an XHTML serializer supporting both DOM and SAX
  31  * pretty serializing. For usage instructions see either {@link
  32  * Serializer} or {@link BaseMarkupSerializer}.
  33  *
  34  * @deprecated This class was deprecated in Xerces 2.6.2. It is
  35  * recommended that new applications use JAXP's Transformation API
  36  * for XML (TrAX) for serializing XHTML. See the Xerces documentation
  37  * for more information.
  38  * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
  39  * @see Serializer
  40  */
  41 @Deprecated
  42 public class XHTMLSerializer
  43     extends HTMLSerializer
  44 {
  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()
  53     {
  54         super( true, new OutputFormat( Method.XHTML, null, false ) );
  55     }
  56 
  57 
  58     /**
  59      * Constructs a new serializer. The serializer cannot be used without
  60      * calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
  61      * first.
  62      */
  63     public XHTMLSerializer( OutputFormat format )
  64     {
  65         super( true, format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
  66     }
  67 
  68 
  69     /**
  70      * Constructs a new serializer that writes to the specified writer
  71      * using the specified output format. If <tt>format</tt> is null,
  72      * will use a default output format.
  73      *
  74      * @param writer The writer to use
  75      * @param format The output format to use, null for the default
  76      */
  77     public XHTMLSerializer( Writer writer, OutputFormat format )
  78     {
  79         super( true, format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
  80         setOutputCharStream( writer );
  81     }
  82 
  83 
  84     /**
  85      * Constructs a new serializer that writes to the specified output
  86      * stream using the specified output format. If <tt>format</tt>
  87      * is null, will use a default output format.
  88      *
  89      * @param output The output stream to use
  90      * @param format The output format to use, null for the default
  91      */
  92     public XHTMLSerializer( OutputStream output, OutputFormat format )
  93     {
  94         super( true, format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
  95         setOutputByteStream( output );
  96     }
  97 
  98 
  99     public void setOutputFormat( OutputFormat format )
 100     {
 101         super.setOutputFormat( format != null ? format : new OutputFormat( Method.XHTML, null, false ) );
 102     }
 103 
 104 
 105 }