Hi,

Here's a patch to pretty print the xml displayed in the right cell.

Much easier to look at!


*** UglyBrowser.java    2004-06-11 15:23:10.000000000 -0600
--- UglyBrowser.java.orig       2004-06-11 15:24:58.000000000 -0600
***************
*** 25,35 ****
  import org.apache.xindice.core.Database;
  import org.apache.xindice.xml.TextWriter;

- import org.apache.xml.serialize.XMLSerializer;
- import org.apache.xml.serialize.OutputFormat;
  import org.w3c.dom.Document;
- import java.io.ByteArrayOutputStream;
-

  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
--- 25,31 ----
***************
*** 191,208 ****
          }

          return "Document '" + document + "'<p>\n"
!             + "<pre>" + escapeHtml(prettyPrint(doc)) + "</pre>";
!     }
!
!     public static String prettyPrint(Document doc) throws Exception {
!         ByteArrayOutputStream out = new ByteArrayOutputStream();
!       OutputFormat format = new OutputFormat(doc);
!       format.setLineWidth(65);
!       format.setIndenting(true);
!       format.setIndent(2);
!       XMLSerializer serializer = new XMLSerializer(out, format);
!       serializer.serialize(doc);
!         return out.toString();
      }

      /* simple function to escape the xml stuff that'll
--- 187,193 ----
          }

          return "Document '" + document + "'<p>\n"
!             + escapeHtml(TextWriter.toString(doc));
      }

      /* simple function to escape the xml stuff that'll


Cheers, Gary
------------------------------------------------------
Gary Orser 
Montana State University
Center for Computational Biology
1 Lewis Hall, Bozeman MT, 59717

Reply via email to