List of usage examples for org.jdom2.output.support FormatStack getIndent
public String getIndent()
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; }/*from w w w . j a va2s .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;//w w w . j ava2s. c o m } 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, "\""); }