directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1525933 - /directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/reponse/BatchResponseDsml.java
Date Tue, 24 Sep 2013 16:06:24 GMT
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();
     }
 }



Mime
View raw message