I have made some very minor changes in tcpmon.java to improve the readability of some SOAP messages when XML formatting is enabled. The source changes have these effects:
- keep start-tags and end-tags together on the same line when there are no interveaning end-tags - suppress extra blank lines by not inserting 'formatting newline' characters after 'input newline' characters - increase the indention width from one blank to three blanks The source changes are attached below. Are they of general interest? If so, how to I contribute them to the Axis project? -- Edward Pring <[EMAIL PROTECTED]> My source changes to tcpmon.java are these lines at the beginning of the run() method ... public void run() { try { byte[] buffer = new byte[4096]; byte[] tmpbuffer = new byte[8192]; int saved = 0 ; int len ; int i1, i2 ; int i ; int reqSaved = 0 ; final int tabWidth = 3; /*** added by Edward Pring ***/ boolean atMargin = true; /*** added by Edward Pring ***/ int thisIndent=-1, nextIndent=-1, previousIndent=-1 ; /* changed by Edward Pring */ inSocket.setSoTimeout(10 ); outSocket.setSoTimeout(10 ); ... and these changes in the middle of the run() method: if ( xmlFormat ) { // Do XML Formatting i2 = 0 ; for( i1 = 0 ; i1 < len ; i1++ ) { /*** begin removed by Edward Pring ... if ( buffer[i1] != '<' && buffer[i1] != '/' ) tmpbuffer[i2++] = buffer[i1]; else { if ( i1+1 < len ) { byte b1 = buffer[i1]; byte b2 = buffer[i1+1]; thisIndent = -1 ; if ( b1 == '<' ) { if ( b2 != '/' ) thisIndent = nextIndent++ ; else thisIndent = --nextIndent ; } else if ( b1 == '/' ) { if ( b2 == '>' ) nextIndent-- ; } if ( thisIndent != -1 ) { tmpbuffer[i2++] = (byte) '\n' ; for ( i = 0 ; i < thisIndent ; i++ ) tmpbuffer[i2++] = (byte) '+' ; } tmpbuffer[i2++] = buffer[i1]; } else { // last char is special - save it saved = 1 ; } } ... end removed by Edward Pring ***/ /*** begin added by Edward Pring ... */ if ( i1+1==len ) { saved = 1; break; } thisIndent = -1; if ( buffer[i1]=='<' && buffer[i1+1]!='/' ) { previousIndent = nextIndent++; thisIndent = nextIndent; } if ( buffer[i1]=='<' && buffer[i1+1]=='/' ) { if (previousIndent>nextIndent) thisIndent = nextIndent; previousIndent = nextIndent--; } if ( buffer[i1]=='/' && buffer[i1+1]=='>' ) { previousIndent = nextIndent--; } if ( thisIndent!=-1 ) { if ( !atMargin ) tmpbuffer[i2++] = (byte)' \n'; for ( i = tabWidth*thisIndent; i>0; i-- ) tmpbuffer[i2++] = (byte)' '; } tmpbuffer[i2++] = buffer[i1]; atMargin = ( buffer[i1]=='\n' ); /* ... end added by Edward Pring ***/ } textArea.append( new String( tmpbuffer, 0, i2 ) ); } else { textArea.append( new String( buffer, 0, len ) ); }