I have a servlet that renders some XML.  For ease of (human) reading I've included newlines ('\n') in the code that generates the output.  Some typical output might look like this:
 
<!DOCTYPE POST_RESULT SYSTEM "ErrorFormat.dtd">
<POST_RESULT>
<ERROR>
<ERROR_CODE>180</ERROR_CODE>
<ERROR_TYPE value="FORMAT"/>
<ERROR_TEXT>First Name is required</ERROR_TEXT>
</ERROR>
</POST_RESULT>
 
I started out writing tests for my servlets using Python and PyUnit.  The strings that I test against include newlines just as I generate them in the servlet.  I got them all working just fine.  Then I decided to port my Python test code over to Java/Cactus.  When  I got the first one ported I found that it always failed because the return value from AssertUtils.getResponseAsString(connection) did not include the newlines that the servlet returns.
 
Now is there something in the framework that removes the newlines or is there something in one of the java.net classes that is doing this?

Reply via email to