All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.enhydra.xml.io.Formatter Maven / Gradle / Ivy

The newest version!
/*
 * Enhydra Java Application Server Project
 * 
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License on
 * the Enhydra web site ( http://www.enhydra.org/ ).
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
 * the License for the specific terms governing rights and limitations
 * under the License.
 * 
 * The Initial Developer of the Enhydra Application Server is Lutris
 * Technologies, Inc. The Enhydra Application Server and portions created
 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
 * All Rights Reserved.
 * 
 * Contributor(s):
 * 
 * $Id: Formatter.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
 */

package org.enhydra.xml.io;

import java.io.IOException;
import java.io.Writer;

import org.w3c.dom.Node;

/**
 * Interface for document-type specific formatters.  Instances are
 * single-threaded.
 */
public interface Formatter {
    /**
     * Get the MIME-preferred encoding, determined from the OutputOptions and
     * the formatter type.
     */
    public String getMIMEEncoding();

    /**
     * Determine if preformatted text was used for the last document formatted.
     * The results are only meaninful if called after a call to write().
     */
    public boolean usedPreFormattedText();

    /**
     * Get the count of preformatted text nodes that were written.
     */
    public int getPreFormattedTextCount();

    /**
     * Get the count of text nodes that were written not using
     * preformatted text.
     */
    public int getDynamicFormattedTextCount();

    /**
     * Determine if preformatted element open tags were used for the last
     * document formatted.  The results are only meaninful if called after a
     * call to write().
     */
    public boolean usedPreFormattedElements();

    /**
     * Get the count of preformatted element open tags that were written.
     */
    public int getPreFormattedElementCount();

    /**
     * Get the count of element open tags that were written not using
     * preformatted text.
     */
    public int getDynamicFormattedElementCount();

    /**
     * Format the contents of a node that can later be returned by a node
     * implementing FormattedText.  Not all node types will return formatted
     * text.
     */
    public String preFormatNode(Node node);

    /**
     * Format any Node to the specified writer.
     */
    public void write(Node node,
                      Writer writer) throws IOException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy