org.docx4j.utils.XMLStreamWriterWrapperIndenting Maven / Gradle / Ivy
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