如果您不使用序列化,那么这看起来非常适合某些“xslt”:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy><xsl:apply-templates select="@* | node()"/></xsl:copy>
</xsl:template>
<xsl:template match="/Items">
<Its><xsl:apply-templates/></Its>
</xsl:template>
<xsl:template match="/Items/Map/Terrains">
<Te><xsl:apply-templates/></Te>
</xsl:template>
<xsl:template match="/Items/Map/Terrains/Item">
<It id="{@id}" r="{@row}" c="{@column}"><xsl:apply-templates select="*"/></It>
</xsl:template>
</xsl:stylesheet>
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("Condense.xslt");
xslt.Transform("Data.xml", "Smaller.xml");
Console.WriteLine("{0} vs {1}",
new FileInfo("Data.xml").Length,
new FileInfo("Smaller.xml").Length);