View Javadoc
1   /*
2    * Copyright 2005 Jukka Zitting <jz@yukatan.fi>
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 net.sf.exorcist.core;
17  
18  import org.apache.xerces.util.XMLChar;
19  import org.xml.sax.Attributes;
20  import org.xml.sax.ContentHandler;
21  import org.xml.sax.SAXException;
22  import org.xml.sax.helpers.AttributesImpl;
23  
24  /***
25   * TODO
26   */
27  public class TableWriter {
28  
29      private static final String PREFIX = "table";
30  
31      private static final String NSURI = "http://exorcist.sf.net/ns/2005/table";
32  
33      private XmlWriter writer;
34  
35      public void setContentHandler(ContentHandler handler) {
36          writer = new XmlWriter();
37          writer.setNamespace(NSURI);
38          writer.setPrefix(PREFIX);
39          writer.setContentHandler(handler);
40      }
41  
42      public void startDocument() throws SAXException {
43          writer.startDocument();
44      }
45  
46      public void endDocument() throws SAXException {
47          writer.endDocument();
48      }
49  
50      public void startTable(String name) throws SAXException {
51          writer.startElement("table", writer.makeAttribute("name", name));
52      }
53  
54      public void endTable() throws SAXException {
55          writer.endElement("table");
56      }
57  
58      public void startRow() throws SAXException {
59          writer.startElement("row", null);
60      }
61  
62      public void endRow() throws SAXException {
63          writer.endElement("row");
64      }
65  
66  }