Home > Backend Development > PHP Tutorial > XML转化作EXECL

XML转化作EXECL

WBOY
Release: 2016-06-13 13:19:22
Original
880 people have browsed it

XML转化为EXECL
我用PHP生成的XML文件 想转化为execl表格表示 
比如说 我的xml为

XML code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--> <subject>
  Basic Information 
 <question>
  What is your age? 
  <answer>8-12</answer> 
  <count>2</count> 
  <ratio>0.01%</ratio> 
  <answer>13-19</answer> 
  <count>43</count> 
  <ratio>0.31%</ratio> 
  <answer>20-34</answer> 
  <count>65</count> 
  <ratio>0.47%</ratio> 
  <answer>35-49</answer> 
  <count>24</count> 
  <ratio>0.18%</ratio> 
  <answer>50+</answer> 
  <count>3</count> 
  <ratio>0.02%</ratio> 
  </question>
<question>
  What is your gender? 
  <answer>Male</answer> 
  <count>119</count> 
  <ratio>0.87%</ratio> 
  <answer>Female</answer> 
  <count>18</count> 
  <ratio>0.13%</ratio> 
  </question></subject>
Copy after login

这个子的话 在EXECL中表示的时候 
只显示最后一层数据 即answer count 和ratio ,question的内容没有显示出来 ,并且answer count ratio 的数据并没有在相应的同一行中。
有没有做个的同学 指导下 该怎么正常显示出XML数据呢

------解决方案--------------------
你的代码?
------解决方案--------------------
EXECL有自己的格式,你只能转换成execl格式才能打开
------解决方案--------------------
PHP解析一下这段XML,然后逗号分隔字段,输出x.csv就可以用excel打开了
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template