Menu

I get no newlines...

Help
2007-04-16
2013-04-09
  • Juan Antonio Martínez Castańo

    Using skaringa-r3p7 on Fedora Core 5 Linux

    this is my code:
    ...
    // The ObjectTransformer interface offers all needed methods.
    objectTransformer = ObjectTransformerFactory.getInstance().getImplementation();
    // The transformer should create extra line feeds in the output.
    objectTransformer.setProperty(javax.xml.transform.OutputKeys.INDENT, "yes");
    // Set the amount of indenting if Xalan is used as XSL transformer.
    objectTransformer.setProperty("{http://xml.apache.org/xalan}indent-amount", "4");
    // omit xsi:type
    objectTransformer.setProperty(com.skaringa.javaxml.PropertyKeys.OMIT_XSI_TYPE, "yes");
    objectTransformer.setProperty(com.skaringa.javaxml.PropertyKeys.OMIT_XSI_NIL, "yes");
    ....

    but when calling serialize() I obtain no newlines nor indentation on resulting
    XML file

    What am I doing wrong?
    Thanks in advance
    Juan Antonio

     
    • Anonymous

      Anonymous - 2007-04-21

      The tasks of adding newlines and indenting the xml is not done by skaringa itself, but by the underlying xslt transformer. So, if you use

      objectTransformer.setProperty("{http://xml.apache.org/xalan}indent-amount", "4");

      it will work only if Xalan is used as the transformer.

      Other transformers, especially those bundled with the Sun JRE may not even create newlines.

      May be that in the future skaringa will do the identing by itself.

      Ciao

      Martin

       

Log in to post a comment.