org.docx4j.utils.XMLStreamWriterWrapperIndenting Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j-core Show documentation
Show all versions of docx4j-core Show documentation
docx4j is a library which helps you to work with the Office Open
XML file format as used in docx
documents, pptx presentations, and xlsx spreadsheets.
package org.docx4j.utils;
import java.util.Arrays;
import java.util.Stack;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.docx4j.openpackaging.parts.JaxbXmlPart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author jharrop
* @since 6.1.0
*/
public class XMLStreamWriterWrapperIndenting extends XMLStreamWriterWrapper {
// TODO: write newline before element with self-closing tag.
protected static Logger log = LoggerFactory.getLogger(XMLStreamWriterWrapperIndenting.class);
private int depth = 0;
// Kohsuke's
private final static Object SEEN_NOTHING = new Object();
private final static Object SEEN_ELEMENT = new Object();
private final static Object SEEN_DATA = new Object();
private Object state = SEEN_NOTHING;
private Stack