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!

Proper use of normalize(); XML spaces not removed

843834Feb 7 2009 — edited Feb 11 2009
Ok so I was up till 3 AM trying to figure out why normalize is not removing white space. I have nothing left to normalize() except my brain. Any help would be appreciated.

Code snippit to remove children & parents
********************************
if( !elemSave ){
while( ((Element) n).hasChildNodes() ) {
((Element) n).removeChild( ((Element) n).getLastChild() );
((Element) n).getParentNode().normalize();
}
//have tried normalize here doesnt close the spaces
((Element) n).getParentNode().removeChild((Element) n);
//tried normalize here doesnt close the spaces
}
document.normalize();
return document;
**************************************

------- Resulting XML ---------
<?xml version="1.0" encoding="UTF-8"?>
<Entity createddate="6/19/08" defaultrole="CONTR_CAND" id="93023" updateddate="2/6/09">
<Role>CONTR_CAND</Role>



<Property bisuniqueid="6172" name="SKILLS" occurrence="1">
<Attribute name="SKILL" sqldatatype="NUMERIC"/>
<Attribute name="YEAR_EXP" sqldatatype="NUMERIC"/>
<Attribute name="LEVEL" sqldatatype="NUMERIC"/>
</Property>






<Property bisuniqueid="4385" name="JOB_CAT" occurrence="1">
<Attribute name="JOB_CATEGORY" sqldatatype="NUMERIC">8253425</Attribute>
</Property>


</Entity>

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 11 2009
Added on Feb 7 2009
13 comments
1,878 views