Initially, sorry for the code seeming long. But it's a bit of a follow up to
yesterdays questions (which I solved thanks to y'alls help).
Ok, so I have an XML file, where I can have any number of nodes, which can
have any number of Children (and they can have children and so on).
Basically, I want to strip a node if it or it's children has no data, or has
no attributes with data anywhere in it's descendants.
I sort of get the logic, but fail miserably to even consider how to fix it
so that the last example works (Checkbox 6) - ie. Stripping a tree half way
down.
ANY help would be great.
Thanks ALot
Bryan.
P.S. the number of children in the example is not overkill, there will
usually be at least 4 - sorry.
ORIGINAL :
<topNode>
<Checkbox1>
<really>
<long>
<really>
<really>
<long
Attribute="0"/>
</really>
</really>
</long>
</really>
</Checkbox1>
<Checkbox2>
<really>
<long>
<really>
<really>
<long> data
</long>
</really>
</really>
</long>
</really>
</Checkbox2>
<Checkbox3>
<really>
<long>
<really>
<really>
<long />
</really>
</really>
</long>
</really>
</Checkbox3>
<Checkbox4>
<really>
<long>
<really>
<really>
<long
Attribute=""/>
</really>
</really>
</long>
</really>
</Checkbox4>
<Checkbox5>
<really>
<long>
<really>
<really>
<long Attribute="0"
attribute=""> data </long>
</really>
</really>
</long>
</really>
</Checkbox5>
<Checkbox6>
<really>
<long Attribute="data">
<really>
<really>
<long/>
</really>
</really>
</long>
</really>
</Checkbox6>
</topNode>
Output :
<topNode>
<Checkbox1>
<really>
<long>
<really>
<really>
<long
Attribute="0"/>
</really>
</really>
</long>
</really>
</Checkbox1>
<Checkbox2>
<really>
<long>
<really>
<really>
<long> data
</long>
</really>
</really>
</long>
</really>
</Checkbox2>
<Checkbox5>
<really>
<long>
<really>
<really>
<long Attribute="0">
data </long>
</really>
</really>
</long>
</really>
</Checkbox5>
<Checkbox6>
<really>
<long Attribute="data" />
</really>
</Checkbox6>
</topNode>