Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

removeChild() problem- Help pls

843834Apr 18 2003 — edited Apr 21 2003
Hi,

I have a problem while using removeChild().
I have an XML file which I am updating with values. I need to delete the nodes which are not having values.
I have used removeChild() to remove the child. The child is removed, but it leavs the blank line. For example, when I delete the child a2 in the following example,
<Header>
<GMAHeader>
<Global>
<a1>test</a1>
<a2></a2>
</Global>
<Local>
<b1>test</b1>
<b2>test</b2>
</Local>
</GMAHeader>
</Header>
the result is as follows.
<Header>
<GMAHeader>
<Global>
<a1>value</a1>
</Global>
<Local>
<b1>value</b1>
<b2>value</b2>
</Local>
</GMAHeader>
</Header>
I have set preservespace(true) in outputFormt. If I dont use this, blank line is removed, but the XML format is not maintained. For example, when I dont use the "set Preservespace(true)", the file appears
as follows.

<Header> <GMAHeader><Global><a1>value</a1>
</Global><Local><b1>value</b1><b2>value</b2></Local>
</GMAHeader></Header>

Can anyone pls suggest what to do for this problem? I have been trying to solve this problem since 3-4 days and no use.
Pls help me.

Regards,
Gayathri.


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2003
Added on Apr 18 2003
2 comments
181 views