View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 1999-2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * 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   * $Id: DOMSerializer.java,v 1.2.4.1 2005/09/15 08:15:15 suresh_emailid Exp $
22   */
23  package com.sun.org.apache.xml.internal.serializer;
24  
25  import java.io.IOException;
26  
27  import org.w3c.dom.Node;
28  
29  /**
30   * Interface for a DOM serializer implementation.
31   * <p>
32   * The DOMSerializer is a facet of a serializer and is obtained from the
33   * asDOMSerializer() method of the Serializer interface.
34   * A serializer may or may not support a DOM serializer, if it does not then the
35   * return value from asDOMSerializer() is null.
36   * <p>
37   * Example:
38   * <pre>
39   * Document     doc;
40   * Serializer   ser;
41   * OutputStream os;
42   *
43   * ser = ...;
44   * os = ...;
45   *
46   * ser.setOutputStream( os );
47   * DOMSerialzier dser = ser.asDOMSerializer();
48   * dser.serialize(doc);
49   * </pre>
50   *
51   * @see Serializer
52   *
53   * @xsl.usage general
54   *
55   */
56  public interface DOMSerializer
57  {
58      /**
59       * Serializes the DOM node. Throws an exception only if an I/O
60       * exception occured while serializing.
61       *
62       * This interface is a public API.
63       *
64       * @param node the DOM node to serialize
65       * @throws IOException if an I/O exception occured while serializing
66       */
67      public void serialize(Node node) throws IOException;
68  }