Greetings Raj,

Does your OMElement tree contain indentation and new line OMText nodes ?

Rich Scheuerle
IBM Web Services
Apache Axis2 ([EMAIL PROTECTED])
512-838-5115  (IBM TL 678-5115)


                                                                       
             Rajalakshmi S                                             
             Iyer                                                      
             <iyer_rajalakshmi                                          To
             @in.ibm.com>              [email protected]       
                                                                        cc
             07/23/2008 12:44                                          
             AM                                                    Subject
                                       Introducing indentation during  
                                       serialization                   
             Please respond to                                         
             [EMAIL PROTECTED]                                         
                 ache.org                                              
                                                                       
                                                                       
                                                                       





Hello,

I am writing the in-memory OMElement to an XML file as follows:

      import javax.xml.stream.XMLOutputFactory;
      import javax.xml.stream.XMLStreamWriter;

      public static void omToStream(FileOutputStream outputStream,
                  OMElement omElement) throws Exception {
            XMLOutputFactory xof = XMLOutputFactory.newInstance();
            XMLStreamWriter writer =
xof.createXMLStreamWriter(outputStream);
            omElement.serialize(writer);
      }

The output XML file generated out of this loses all indentation and new
lines. All the XML tags and values appear on the same line.

The OMOutputFormat does not seem to allow for setting the indentation
property.

I would appreciate any help in this regard.

Thanks,
Best regards,
Rajalakshmi Iyer


Reply via email to