cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DOM Output?
Date Tue, 16 Oct 2001 22:36:17 GMT

I'm using Tomcat and Cocoon together, and I have the xerces jar file
in tomcat/lib.  The following fragment works great in a servlet...

public void output() {
  try {
    DOMImplementation imp = new DOMImplementationImpl();
    Document doc = imp.createDocument(null, "page", null);

    Element root = doc.getDocumentElement();
    Element title = doc.createElement("title");
  catch(Exception e) {

Once my document is build, how do I output formatted XML?  For the
life of me I can't find an example of building and XML doc with xerces
and outputting the formated XML.

One example I found uses this:

XmlDocument doc = new XmlDocument();
.... Build doc....

where "out" is a OutputStreamWriter.  This would be great!  Except
that I get a class def not found for XmlDocument (I guess it's in
tomcat's xml.jar?)

I'm doing all this so that cocoon can receive XML from a servlet and
format it.  And I'm doing that because JConnect (Sybase JDBC) doesn't
want to work from a Cocoon XML page (although it works fine in my

Everything else works.  If I simply print out the XML "by hand" in the
servlet, Cocoon applies my style sheet perfectly!  All I need to know
is how to output the XML.

PS - the XmlDocument method works fine in my Visual Age environment
where I have Tomcat source loaded and running.  I thought I had my
solution until I found that that class can't be found in the
production install.

Jeff Sexton
ODS Health Plans

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message