Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 Freemarker Team.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:      
 *     Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 *******************************************************************************/

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

public class Main {
    /**
     * Start XML element. Ex : <elementName
     * 
     * @param elementName
     * @param writer
     * @throws IOException
     */
    public static void startElement(String elementName, Writer writer) throws IOException {
        startElement(elementName, false, writer);
    }

    /**
     * Start XML element and close it. Ex : <elementName>
     * 
     * @param elementName
     * @param endTag
     * @param writer
     * @throws IOException
     */
    public static void startElement(String elementName, boolean endTag, Writer writer) throws IOException {
        writer.write("<");
        writer.write(elementName);
        if (endTag) {
            writer.write(">");
        }
    }
}