views:

12

answers:

0

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!