remove the blank rows after i removed xml elements?

Posted by fayer on Stack Overflow See other posts from Stack Overflow or by fayer
Published on 2010-03-24T18:41:34Z Indexed on 2010/03/24 18:43 UTC
Read the original article Hit count: 213

Filed under:
|
|
|

i removed some elements from a xml file with simpledom.

the code:

$this->xmlDocument->removeNodes("//entity[name='mac']");

here is the initial file:

<entity id="1000070">
    <name>apple</name>
    <type>category</type>
    <entities>
        <entity id="7002870">
            <name>mac</name>
            <type>category</type>
        </entity>
        <entity id="7024080">
            <name>iphone</name>
            <type>category</type>
        </entity>
        <entity id="7024080">
            <name>ipad</name>
            <type>category</type>
        </entity>
    </entities>
</entity>

the file afterwards:

<entity id="1000070">
    <name>apple</name>
    <type>category</type>
    <entities>




        <entity id="7024080">
            <name>iphone</name>
            <type>category</type>
        </entity>
        <entity id="7024080">
            <name>ipad</name>
            <type>category</type>
        </entity>
    </entities>
</entity>

i wonder how i could also remove the blank lines that are left after i ran the removal code?

thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml