-- 作者:ccseven
-- 发布时间:9/25/2011 3:49:00 PM
-- 请教:一个xml文件,怎么自动变化成我需要格式?
[color=#00FF99][color=#00FF00] 我需要的格式如下:(只需要关注<dials>中的 value="60.2" ) <Chart palette="1" lowerLimit="0" upperLimit="100" gaugeStartAngle="240" gaugeEndAngle="-60" gaugeInnerRadius="60%" gaugeFillMix="{light-10},{light-30},{light-20},{dark-5},{color},{light-30},{light-20},{dark-10}" gaugeFillRatio="" decimals="1"> <colorRange> <color minValue="0" maxValue="30"/> <color minValue="30" maxValue="50"/> <color minValue="50" maxValue="80"/> <color minValue="80" maxValue="100"/> </colorRange> <dials> <dial id="Dial1" value="60.2" baseWidth="6" topWidth="1" editMode="1" showValue="1" rearExtension="10" valueY="200"/> </dials> <styles> <definition> <style type="font" name="valueFont" bold="1" size="13"/> </definition> <application> <apply toObject="value" styles="valueFont"/> </application> </styles> </Chart> 我具有的xml文件格式如下:(里面<lastvalue>的值变成上面格式中的 value=“”) <?xml version="1.0" encoding="UTF-8" ?> <channels> <prtg-version>7.2.5.5114</prtg-version> <item> <lastvalue>8 %</lastvalue> ####这个字段要变成上面那个XML的 value="8"## <lastvalue_RAW>0000000000000080.0000</lastvalue_RAW> <datetime>2011-9-25 14:26:48</datetime> <datetime_RAW>40811.2686127315</datetime_RAW> </item> </channels> [/color][/color] 其中我有的xml 文件是通过http get 得到的,我要做到效果是,当get到xml文件后,自动将里面内容转换成我希望的格式...... 哪位兄弟有空可以帮帮忙么,我不是做软件这块的,所以不太懂。
|