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
This commit is contained in:
Yegor Kozlov 2012-05-05 08:25:08 +00:00
parent eee49e3709
commit 3722fd2a70
4 changed files with 18 additions and 24 deletions

View File

@ -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("<Numchildren>").append(getChildRecords().size()).append("</Numchildren>\n")
.append(tab).append("\t").append("<IsContainer>").append(isContainerRecord()).append("</IsContainer>\n");
for (EscherProperty property: getEscherProperties()){
builder.append(property.toXml(tab+"\t"));
}
builder.append(tab).append("</").append(getClass().getSimpleName()).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("</").append(getClass().getSimpleName()).append(">\n");
return builder.toString();
}
}

View File

@ -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("</").append(getClass().getSimpleName()).append(">\n");
return builder.toString();
}

View File

@ -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("<RecordName>").append(getRecordName()).append("</RecordName>\n")
.append(tab).append("\t").append("<IsContainer>").append(isContainerRecord()).append("</IsContainer>\n")
.append(tab).append("\t").append("<Numchildren>").append(HexDump.toHex(_childRecords.size())).append("</Numchildren>\n");
builder.append(tab).append(formatXmlRecordHeader(getRecordName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance())));
for ( Iterator<EscherRecord> iterator = _childRecords.iterator(); iterator
.hasNext(); )
{
EscherRecord record = iterator.next();
builder.append(record.toXml(tab+"\t"));
}
builder.append(tab).append("</").append(getClass().getSimpleName()).append(">\n");
builder.append(tab).append("</").append(getRecordName()).append(">\n");
return builder.toString();
}

View File

@ -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("<IsContainer>").append(isContainerRecord()).append("</IsContainer>\n")
.append(tab).append("\t").append("<Numchildren>").append(getChildRecords().size()).append("</Numchildren>\n")
.append(tab).append("\t").append("<ExtraData>").append(theDumpHex).append("</ExtraData>\n");
builder.append(tab).append("</").append(getClass().getSimpleName()).append(">\n");
return builder.toString();