XML使用字符串拼接循环拼接问题?
如上图所示,我现在要做一个三维图表:
这是标注XML格式:<chart palette='2' caption='Country Comparison' showLabels='1' showvalues='0' decimals='0' numberPrefix='$' clustered='0' exeTime='1.5' showPlotBorder='0' zGapPlot='30' zDepth='90' divLineEffect='emboss' startAngX='10' endAngX='18' startAngY='-10' endAngY='-40'>
<categories>
<category label='Austria' />
<category label='Brazil' />
<category label='France' />
<category label='Germany' />
<category label='USA' />
</categories>
<dataset seriesName='1998' color='8BBA00' showValues='0'>
<set value='45000.65' />
<set value='44835.76' />
<set value='18722.18' />
<set value='77557.31' />
<set value='92633.68' />
</dataset>
<dataset seriesName='1997' color='F6BD0F' showValues='0'>
<set value='57401.85' />
<set value='41941.19' />
<set value='45263.37' />
<set value='117320.16' />
<set value='114845.27' />
</dataset>
<dataset seriesName='1996' color='AFD8F8' showValues='0'>
<set value='25601.34' />
<set value='20148.82' />
<set value='17372.76' />
<set value='35407.15' />
<set value='38105.68' />
</dataset>
<styles>
<definition>
<style name='captionFont' type='font' size='15' />
</definition>
<application>
<apply toObject='caption' styles='captionfont' />
</application>
</styles>
</chart>
下面是我自己在java类里拼接但是每次到循环哪里都拼接不对,导致数据输出错误,图表无法显示:
public String buildChart(List<YearSale> datas) {
StringBuilder sb = new StringBuilder("<?xml version='1.0' encoding='UTF-8'?>");