From 23658fddc52ef3f2e9d9e2deb3f8c81b5e14a981 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sat, 5 May 2012 08:25:08 +0000 Subject: [PATCH] polishing BiffDrawingToXml: more readable output and removed unnecessary tags git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1334342 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/ddf/AbstractEscherOptRecord.java | 31 +++++++++---------- .../apache/poi/ddf/EscherComplexProperty.java | 2 +- .../apache/poi/ddf/EscherContainerRecord.java | 7 ++--- .../apache/poi/ddf/EscherTextboxRecord.java | 2 -- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java b/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java index 9606fd7603..a86fbda669 100644 --- a/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java +++ b/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java @@ -173,19 +173,18 @@ public abstract class AbstractEscherOptRecord extends EscherRecord stringBuilder.append( " " + property.toString() + nl ); } - return stringBuilder.toString(); - } - - @Override - public String toXml(String tab) { - StringBuilder builder = new StringBuilder(); - builder.append(tab).append(formatXmlRecordHeader(getClass().getSimpleName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance()))) - .append(tab).append("\t").append("").append(getChildRecords().size()).append("\n") - .append(tab).append("\t").append("").append(isContainerRecord()).append("\n"); - for (EscherProperty property: getEscherProperties()){ - builder.append(property.toXml(tab+"\t")); - } - builder.append(tab).append("\n"); - return builder.toString(); - } -} + return stringBuilder.toString(); + } + + @Override + public String toXml(String tab) { + StringBuilder builder = new StringBuilder(); + builder.append(tab).append(formatXmlRecordHeader(getClass().getSimpleName(), + HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance()))); + for (EscherProperty property: getEscherProperties()){ + builder.append(property.toXml(tab+"\t")); + } + builder.append(tab).append("\n"); + return builder.toString(); + } +} diff --git a/src/java/org/apache/poi/ddf/EscherComplexProperty.java b/src/java/org/apache/poi/ddf/EscherComplexProperty.java index d3db3469a4..8cdd46f5a0 100644 --- a/src/java/org/apache/poi/ddf/EscherComplexProperty.java +++ b/src/java/org/apache/poi/ddf/EscherComplexProperty.java @@ -140,7 +140,7 @@ public class EscherComplexProperty extends EscherProperty { builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId())) .append("\" name=\"").append(getName()).append("\" blipId=\"") .append(isBlipId()).append("\">\n"); - builder.append("\t").append(tab).append(dataStr); + //builder.append("\t").append(tab).append(dataStr); builder.append(tab).append("\n"); return builder.toString(); } diff --git a/src/java/org/apache/poi/ddf/EscherContainerRecord.java b/src/java/org/apache/poi/ddf/EscherContainerRecord.java index bed9619d11..4190594b54 100644 --- a/src/java/org/apache/poi/ddf/EscherContainerRecord.java +++ b/src/java/org/apache/poi/ddf/EscherContainerRecord.java @@ -258,17 +258,14 @@ public final class EscherContainerRecord extends EscherRecord { @Override public String toXml(String tab) { StringBuilder builder = new StringBuilder(); - builder.append(tab).append(formatXmlRecordHeader(getClass().getSimpleName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance()))) - .append(tab).append("\t").append("").append(getRecordName()).append("\n") - .append(tab).append("\t").append("").append(isContainerRecord()).append("\n") - .append(tab).append("\t").append("").append(HexDump.toHex(_childRecords.size())).append("\n"); + builder.append(tab).append(formatXmlRecordHeader(getRecordName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance()))); for ( Iterator iterator = _childRecords.iterator(); iterator .hasNext(); ) { EscherRecord record = iterator.next(); builder.append(record.toXml(tab+"\t")); } - builder.append(tab).append("\n"); + builder.append(tab).append("\n"); return builder.toString(); } diff --git a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java index 12a0dcccd8..c21c227968 100644 --- a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java +++ b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java @@ -155,8 +155,6 @@ public class EscherTextboxRecord extends EscherRecord } StringBuilder builder = new StringBuilder(); builder.append(tab).append(formatXmlRecordHeader(getClass().getSimpleName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance()))) - .append(tab).append("\t").append("").append(isContainerRecord()).append("\n") - .append(tab).append("\t").append("").append(getChildRecords().size()).append("\n") .append(tab).append("\t").append("").append(theDumpHex).append("\n"); builder.append(tab).append("\n"); return builder.toString(); -- 2.39.5