Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//   Licensed under the Apache License, Version 2.0 (the "License"); you may

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

public class Main {
    public static XMLStreamWriter CreateSimpleTagAndContent(XMLStreamWriter serializer, String tag, String content)
            throws XMLStreamException {
        return CreateSimpleTagAndContent(serializer, tag, content, true);
    }

    public static XMLStreamWriter CreateSimpleTagAndContent(XMLStreamWriter serializer, String tag, String content,
            boolean allow_empty) throws XMLStreamException {
        if (!allow_empty && content.equals(""))
            return serializer;
        serializer.writeStartElement(tag);
        serializer.writeCharacters(content);
        serializer.writeEndElement(); // end simple tag
        return serializer;
    }
}