Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4506998

HTTP header is included in the output of transformation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.4.0
    • core-libs
    • None
    • sparc
    • solaris_8

      I am getting the following few lines in the output when transformation is done.

      HTTP/1.1 200 OK
      Content-Length: 0
      Date: Sat, 22 Sep 2001 01:35:02 GMT
      Server: Apache Tomcat/4.0-rc2 (HTTP/1.1 Connector)

      This happens for tomcat 4.0-rc2. The dtd for this xml file is at
      "http://sardinia:8080/JAXPREP/publishers.dtd"

      I am including some code for your reference. I am also attaching the output file
      generated.

                  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                  dbf.setValidating(true);
                  DocumentBuilder docBuilder = dbf.newDocumentBuilder();
                  Document document = docBuilder.parse(new File( "publish2.xml"));
                  DOMSource domSource= new DOMSource(document);

                  Transformer transformer = tfactory.newTransformer();
                  transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC ,
                      "-//mkrishna mohan//DTD//music pub//EN/");
                  transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM ,
                      "http://sardinia:8080/publishers.dtd");
                  transformer.setOutputProperty(OutputKeys.INDENT , "yes");

                  FileOutputStream fos = new FileOutputStream("doctype.out");
                  transformer.transform(domSource, new StreamResult(fos));

      ============================
      To reproduce,
      Use the following URL: "http://sardinia:8080/JAXPREP/familytree.dtd" and read from the input stream to get response headers instead of an EOF. The "publishers.dtd" version works, however. Using a host of "skyblue" also works because the webserver is an older version of Tomcat.
      ###@###.### 2001-09-27

            jccollet Jean-Christophe Collet (Inactive)
            bhamehta Bhakti Mehta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: