帮助进行 xml 转换
这样的东西
<NewDataSet>
<Table>
<dnis>Dec 5 Call</dnis>
<monthval>12</monthval>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
</Table>
</NewDataSet>
我怎样才能改变像To
<?xml version="1.0" encoding="utf-8"?>
<NewDataSet>
<Table>
<Header>
<dnis>Dec 5 Call</dnis>
<monthval>12</monthval>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Header>
<Body>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
</Body>
</Table>
</NewDataSet>
how can I transform some thing like
<NewDataSet>
<Table>
<dnis>Dec 5 Call</dnis>
<monthval>12</monthval>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
</Table>
</NewDataSet>
To
<?xml version="1.0" encoding="utf-8"?>
<NewDataSet>
<Table>
<Header>
<dnis>Dec 5 Call</dnis>
<monthval>12</monthval>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Header>
<Body>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
<Row>
<dnis>Dec 5 Call</dnis>
<Week>Dec 5-Dec 11</Week>
<Totalcalls>2</Totalcalls>
<AvgDuration>23</AvgDuration>
<TotalHangups>34</TotalHangups>
<TotalHangupsaftClosedMsg>23</TotalHangupsaftClosedMsg>
<TotalCallstoAgent>2</TotalCallstoAgent>
</Row>
</Body>
</Table>
</NewDataSet>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个:
Try this:
基于身份模板的解决方案:
An identity template based solution:
您可以使用 XSLT 或仅解析第一个 Xml、提取节点并创建第二个 Xml。
You an either use XSLT or just parse the first Xml, extract the nodes, and create the second Xml.