Little help with: Java XML DOM alot of white space between tags
807569Jul 28 2006 — edited Aug 14 2006I was wondering if anyone got any idea how to control the white space that are left back after a successful delete on an element?.
The thing is, that I have an xml similar to:
...
<batch>
<invoice>
... <- some nodes in here e.t.c
</invoice>
<invoice>
...
</invoice>
<invoice>
...
</invoice>
<sometag1></sometag1>
<sometag2></sometag2>
</batch>
...
I'm removing child's from <batch> based on general delete operations through .removeChilds(), and so on and so forth.
The outcome is as expected, besides one thing:
...
<batch>
<sometag1></sometag1>
<sometag2></sometag2>
</batch>
...
, look at the big gap between <batch> and its childs sometag1 and sometag2 now.
By inserting a new tag to batch after this - same "type" as <invoice> that I deleted earlier - with using .insertBefore() on <sometag1> ,I now get:
...
<batch>
<invoice>
...
</invoice>
<sometag1></sometag1>
<sometag2></sometag2>
</batch>
...
, still with the gaps...
So by using transformer to save this file as an XMLfile, I still STORE that very spacing in <batch>-tag.
Have any of you encounter this problem before, or have a nifty solution on how to cope with this?
In advance thanks if you could bother trying to help out - since this has taken me ages to "google" around and chekcing API for this with no luck:)
P�l (Paul), Norway