KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > io > Formatter


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: Formatter.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.io;
25
26 import java.io.IOException JavaDoc;
27 import java.io.Writer JavaDoc;
28
29 import org.w3c.dom.Node JavaDoc;
30
31 /**
32  * Interface for document-type specific formatters. Instances are
33  * single-threaded.
34  */

35 public interface Formatter {
36     /**
37      * Get the MIME-preferred encoding, determined from the OutputOptions and
38      * the formatter type.
39      */

40     public String JavaDoc getMIMEEncoding();
41
42     /**
43      * Determine if preformatted text was used for the last document formatted.
44      * The results are only meaninful if called after a call to write().
45      */

46     public boolean usedPreFormattedText();
47
48     /**
49      * Get the count of preformatted text nodes that were written.
50      */

51     public int getPreFormattedTextCount();
52
53     /**
54      * Get the count of text nodes that were written not using
55      * preformatted text.
56      */

57     public int getDynamicFormattedTextCount();
58
59     /**
60      * Determine if preformatted element open tags were used for the last
61      * document formatted. The results are only meaninful if called after a
62      * call to write().
63      */

64     public boolean usedPreFormattedElements();
65
66     /**
67      * Get the count of preformatted element open tags that were written.
68      */

69     public int getPreFormattedElementCount();
70
71     /**
72      * Get the count of element open tags that were written not using
73      * preformatted text.
74      */

75     public int getDynamicFormattedElementCount();
76
77     /**
78      * Format the contents of a node that can later be returned by a node
79      * implementing FormattedText. Not all node types will return formatted
80      * text.
81      */

82     public String JavaDoc preFormatNode(Node JavaDoc node);
83
84     /**
85      * Format any Node to the specified writer.
86      */

87     public void write(Node JavaDoc node,
88                       Writer JavaDoc writer) throws IOException JavaDoc;
89 }
90
Popular Tags