FULL PRODUCT VERSION :
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux dellwork 2.6.13-15.13-smp #1 SMP Tue Nov 28 13:43:50 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
An xml file is loaded and parsed (with validation) into a DOM.
NO errors.
Then the same xml file is put through Transformer.transform() it it gives a parse error.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
NO output is correct behavior.
ACTUAL -
You get a parse error from Transformer.transform(). It does not like
DTD.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
The error is:
ERROR:  'ParseError at [row,col]:[1,250]
Message: found: DTD, expected START_ELEMENT or END_ELEMENT'
(This error should not occur. It comes from Transformer.transform(),
not DocumentBuilder.parse(), which reports no errors.)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
    	String xmlDT = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <!DOCTYPE bookstore [ <!ELEMENT bookstore (book)*> <!ELEMENT book (title,author,price)> <!ATTLIST book genre CDATA #REQUIRED> <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT price (#PCDATA)> ]> <bookstore> <book genre=\"fantasy\" > <title>Oberon's Legacy</title> <author>Corets, Eva</author> <price>5.95</price> </book> </bookstore>";
    	XMLInputFactory f = XMLInputFactory.newInstance();
    	ByteArrayInputStream xml = new ByteArrayInputStream(xmlDT.getBytes());
	DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     	factory.setNamespaceAware(true);
    	factory.setValidating(true);
	DocumentBuilder builder = factory.newDocumentBuilder();
    	Document node = builder.parse(xml);
    	xml.reset();
    	XMLStreamReader p0 = f.createXMLStreamReader(xml);
    	try {
    		TransformerFactory xformFactory = TransformerFactory.newInstance();
     		Transformer idTransform = xformFactory.newTransformer();
    		Source input = new StAXSource(p0);
    		PipedOutputStream ps = new PipedOutputStream();
    		PipedInputStream is = new PipedInputStream(ps);
    		Result output = new StreamResult(ps);
    		// BUG the transform gives a parse error,
    		// it won't accept DTD.
    		idTransform.transform(input, output);
    		ps.close();
     	} catch (Exception e) {
    	}
---------- END SOURCE ----------