dongxiezhuo8852 2010-12-02 06:37
浏览 47

使用php将xml转换为html

I want to convert xml data into html. Below is sample xml data and I want to get/convert it in html format.

<content type="html">
  <paragraph id="1291266887">
      <div class="red">
        <span id="main_post_id">
          <p>ten post przedstawia jak wys&#x142;a&#x107;  znacznik&#xF3;w w ust <strong>Ling</strong> -  xyz</p>
          <p>tags znane jako <span class="translation_section  section_2">bezpieczne</span>, b&#x119;d&#x105;  traktowane jako sekcje pkt</p>
          <p>innych materia&#x142;&#xF3;w dziel&#x105;  si&#x119; na <em>literach</em></p>
        </span>
      </div>
  </paragraph>
</content>

i.e. I want to get all the html code contained between <paragraph id="..."></paragraph>. I want to do it using php. When I convert it in array using php, it gives all data in array of div, p, span. But I want whole html contained in <paragraph>..</paragraph> tag in a single array.

Please help needed here. Let me know best ways for this.

Thanks.

  • 写回答

3条回答 默认 最新

  • download2014711 2010-12-02 06:40
    关注

    Write a XSLT stylesheet to convert it, and the xslt extension to apply it to the XML.

    评论

报告相同问题?

悬赏问题

  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂