View Javadoc

1   /*
2    * Copyright 2001-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  package org.saxbenchmark;
17  
18  import java.io.Writer;
19  
20  import org.apache.xml.serializer.ToHTMLStream;
21  import org.xml.sax.ContentHandler;
22  
23  /***
24   * @author JMcCrindle
25   */
26  public class ToHtmlOutputterFactory implements OutputterFactory {
27  
28      /* (non-Javadoc)
29       * @see org.saxbenchmark.OutputterFactory#getHtmlWriter()
30       */
31      public Outputter getHtmlWriter() {
32          final ToHTMLStream serializer = new ToHTMLStream();
33          return new Outputter() {
34              /* (non-Javadoc)
35               * @see org.saxbenchmark.Outputter#asContentHandler()
36               */
37              public ContentHandler asContentHandler() throws Exception {
38                  return serializer;
39              }
40  
41              /* (non-Javadoc)
42               * @see org.saxbenchmark.Outputter#setWriter(java.io.Writer)
43               */
44              public void setWriter(Writer writer) throws Exception {
45                  serializer.setWriter(writer);
46              }
47          };
48      }
49  
50      /* (non-Javadoc)
51       * @see org.saxbenchmark.OutputterFactory#getName()
52       */
53      public String getName() {
54          return "org.apache.xml.serializer.ToHTMLStream";
55      }
56      
57      /* (non-Javadoc)
58       * @see org.saxbenchmark.OutputterFactory#getName()
59       */
60      public String getShortName() {
61          return "ToHTMLStream";
62      }
63      
64  }