You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2013/09/24 18:06:24 UTC

svn commit: r1525933 - /directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/reponse/BatchResponseDsml.java

Author: kayyagari
Date: Tue Sep 24 16:06:24 2013
New Revision: 1525933

URL: http://svn.apache.org/r1525933
Log:
o added a new method with a flag to turn off pretty printing the response while converting to DSML
o retained toDsml() method for backward compatibility

Modified:
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/reponse/BatchResponseDsml.java

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/reponse/BatchResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/reponse/BatchResponseDsml.java?rev=1525933&r1=1525932&r2=1525933&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/reponse/BatchResponseDsml.java (original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/reponse/BatchResponseDsml.java Tue Sep 24 16:06:24 2013
@@ -131,11 +131,26 @@ public class BatchResponseDsml
 
     /**
      * Converts this Batch Response to its XML representation in the DSMLv2 format.
+     * The XML document will be formatted for pretty printing by default. 
+     * 
+     * @see {@link #toDsml(boolean)}
      * 
      * @return the XML representation in DSMLv2 format
      */
     public String toDsml()
     {
+       return toDsml( true ); 
+    }
+    
+    
+    /**
+     * Converts this Batch Response to its XML representation in the DSMLv2 format.
+     * 
+     * @param prettyPrint if true, formats the document for pretty printing
+     * @return the XML representation in DSMLv2 format
+     */
+    public String toDsml( boolean prettyPrint )
+    {
         Document document = DocumentHelper.createDocument();
         Element element = document.addElement( "batchResponse" );
 
@@ -154,6 +169,11 @@ public class BatchResponseDsml
             response.toDsml( element );
         }
 
-        return ParserUtils.styleDocument( document ).asXML();
+        if( prettyPrint )
+        {
+            document = ParserUtils.styleDocument( document );
+        }
+        
+        return document.asXML();
     }
 }