KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > xml > XMLOutput


1 /*
2  * XML input/output support for FindBugs
3  * Copyright (C) 2004, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.xml;
21
22 import java.io.IOException JavaDoc;
23
24 /**
25  * Interface to generate an XML document in some form.
26  * E.g., writing it to a stream, generating SAX events,
27  * etc.
28  *
29  * @author David Hovemeyer
30  */

31 public interface XMLOutput {
32     /**
33      * Begin the XML document.
34      */

35     public void beginDocument() throws IOException JavaDoc;
36
37     /**
38      * Open a tag with given name.
39      *
40      * @param tagName the tag name
41      */

42     public void openTag(String JavaDoc tagName) throws IOException JavaDoc;
43
44     /**
45      * Open a tag with given name and given attributes.
46      *
47      * @param tagName the tag name
48      * @param attributeList the attributes
49      */

50     public void openTag(String JavaDoc tagName, XMLAttributeList attributeList) throws IOException JavaDoc;
51
52     /**
53      * Start a tag, with the intention of adding attributes.
54      * Must be followed by stopTag after zero or more addAttribute
55      * calls.
56      *
57      * @param tagName the tag name
58      */

59     public void startTag(String JavaDoc tagName) throws IOException JavaDoc;
60     
61     /**
62      * Add an attribute to a started tag.
63      * Must follow a call to startTag.
64      *
65      * @param name the attribute name.
66      * @param value the attribute value, unescaped.
67      */

68     public void addAttribute(String JavaDoc name, String JavaDoc value) throws IOException JavaDoc;
69
70     /**
71      * End a started tag.
72      * Must follow a call to startTag.
73      *
74      * @param close true if the element has no content.
75      */

76     public void stopTag(boolean close) throws IOException JavaDoc;
77
78     /**
79      * Open and close tag with given name.
80      *
81      * @param tagName the tag name
82      */

83     public void openCloseTag(String JavaDoc tagName) throws IOException JavaDoc;
84
85     /**
86      * Open and close tag with given name and given attributes.
87      *
88      * @param tagName the tag name
89      * @param attributeList the attributes
90      */

91     public void openCloseTag(String JavaDoc tagName, XMLAttributeList attributeList) throws IOException JavaDoc;
92
93     /**
94      * Close tag with given name.
95      *
96      * @param tagName the tag name
97      */

98     public void closeTag(String JavaDoc tagName) throws IOException JavaDoc;
99
100     /**
101      * Write text to the XML document.
102      * XML metacharacters are automatically escaped.
103      *
104      * @param text the text to write
105      */

106     public void writeText(String JavaDoc text) throws IOException JavaDoc;
107
108     /**
109      * Write a CDATA section to the XML document.
110      * The characters are not escaped in any way.
111      *
112      * @param cdata the character data to write
113      */

114     public void writeCDATA(String JavaDoc cdata) throws IOException JavaDoc;
115
116     /**
117      * Finish writing XML output, closing any underlying
118      * resources (such as output streams).
119      * A call to this method should always be made,
120      * even if one of the XML-generation methods throws an
121      * exception. Therefore, a call to this method should
122      * be performed in a finally block.
123      */

124     public void finish() throws IOException JavaDoc;
125 }
126
127 // vim:ts=4
128
Popular Tags