Example usage for org.jdom2.output.support FormatStack getLevelIndent

List of usage examples for org.jdom2.output.support FormatStack getLevelIndent

Introduction

In this page you can find the example usage for org.jdom2.output.support FormatStack getLevelIndent.

Prototype

public String getLevelIndent() 

Source Link

Usage

From source file:com.googlesource.gerrit.plugins.manifest.CustomOutputter.java

License:Apache License

@Override
protected void printAttribute(java.io.Writer out, FormatStack fstack, Attribute attribute)
        throws java.io.IOException {
    // Do not print attributes that use default values
    for (DTDAttribute dtdAttribute : dtdAttributes) {
        if (attribute.getName().equals(dtdAttribute.getAttributeName())
                && attribute.getParent().getName().equals(dtdAttribute.getElementName())
                && attribute.getAttributeType().toString().equals(dtdAttribute.getType())
                && attribute.getValue().equals(dtdAttribute.getValue())) {
            return;
        }//ww w . ja v  a2s.  c o m
    }

    out.append(fstack.getLineSeparator());
    String indent = fstack.getIndent();
    out.append(fstack.getLevelIndent());
    out.append(indent);
    // super.printAttribute() indents with an extra space, this will offset that
    out.append(indent.substring(0, indent.length() - 1));
    super.printAttribute(out, fstack, attribute);
}

From source file:io.wcm.maven.plugins.contentpackage.unpacker.OneAttributePerLineXmlProcessor.java

License:Apache License

@Override
protected void printAttribute(Writer out, FormatStack fstack, Attribute attribute) throws IOException {
    if (!attribute.isSpecified() && fstack.isSpecifiedAttributesOnly()) {
        return;/*from w  w w. j a  va2 s .c  om*/
    }

    write(out, StringUtils.defaultString(fstack.getLineSeparator()));
    write(out, StringUtils.defaultString(fstack.getLevelIndent()));
    write(out, StringUtils.defaultString(fstack.getIndent()));
    write(out, StringUtils.defaultString(fstack.getIndent()));

    write(out, attribute.getQualifiedName());
    write(out, "=");

    write(out, "\"");
    attributeEscapedEntitiesFilter(out, fstack, attribute.getValue());
    write(out, "\"");
}