You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Luis Costa <lu...@alert.pt> on 2008/04/24 17:14:58 UTC

OMElement remove empty spaces

Hi there,

 

I'm Using org.apache.axiom.om.OMElement, 

OMElement.detach() instruction is creating empty spaces in final OMElement

 

// remove all the top level children

OMElement yyy = find_xxx();

for (Iterator it= yyy.getChildElements(); it.hasNext(); ) {

      OMElement child = (OMElement) it.next();

// is here where the empty spaces are being added

      child.detach();

}

 

// add the top level children

for (int i=0; i<objects.size(); i++) {

      OMElement ele = (OMElement) objects.get(i);

// is here where I add new Child and empty spaces continue to exist

      yyy.addChild(ele);

}

 

 

Final result:

 

 

<aaa>

    <bbb>

        <ccc>

            

 

 

<!- empty stace -->

 

            

        <ddd/>

                    <eee/>

                </ccc>

    </bbb>

</aaa>

 

 

Question:

Is there a way to remove those empty spaces?

 

 

 

 

Thank you for your attention and best regards,

 

Luís Costa

Software Developer

 

luis.costa@alert.pt <ma...@alert.pt> 

 

www.alert-online.pt <http://www.alert-online.pt/> 

 

 

ALERT Life Sciences Computing, S.A.

Edifício Lake Towers - pisos 7, 8 e 9

Rua Daciano Baptista Marques, n.º 245

4400-617 Vila Nova de Gaia

Portugal

Tel.: +351 22 832 89 80

Fax.: +351 22 832 89 82

info@alert.pt <ma...@alert.pt> 

 

This e-mail is privileged, confidential and contains private information. Any reading, retention, distribution or copying of this communication by any person other than its intended recipient is prohibited.