我想使用 cakephp 或使用 DOM 元素的 Php 更改以下 xml 文件的格式。
<child>
<Lunchmenu>
<id>1</id>
<lunch_date>2013-10-25</lunch_date>
<class_id>1</class_id>
<batch_id/>
<school_id>1</school_id>
<Eatable>
<eatable_name>Noodles</eatable_name>
</Eatable>
</Lunchmenu>
<Lunchmenu>
<id>2</id>
<lunch_date>2013-10-24</lunch_date>
<class_id/>
<batch_id/>
<school_id>1</school_id>
<Eatable>
<eatable_name>Apples</eatable_name>
</Eatable>
</Lunchmenu>
<Lunchmenu>
<id>2</id>
<lunch_date>2013-10-24</lunch_date>
<class_id/>
<batch_id/>
<school_id>1</school_id>
<Eatable>
<eatable_name>Orange</eatable_name>
</Eatable>
</Lunchmenu>
</child>
至
<child>
<Lunchmenu>
<id>1</id>
<lunch_date>2013-10-25</lunch_date>
<class_id>1</class_id>
<batch_id/>
<school_id>1</school_id>
<Eatable>
<eatable_name>Noodles</eatable_name>
</Eatable>
</Lunchmenu>
<Lunchmenu>
<id>2</id>
<lunch_date>2013-10-24</lunch_date>
<class_id/>
<batch_id/>
<school_id>1</school_id>
<Eatable>
<eatable_name>Apples</eatable_name>
</Eatable>
<Eatable>
<eatable_name>Orange</eatable_name>
<Eatable>
</Lunchmenu>
我试过但没有成功。