D
dibblego
Hello,
Can anyone please confirm or otherwise, that the following source test
case produces unexpected behaviour? I have found nothing in the bug
parade thus far.
This code is also available at http://www.xdweb.net/~dibblego/X.java
Thanks for any pointers.
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerException;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.io.Writer;
import java.io.StringWriter;
import java.io.StringReader;
// JDK 1.5.0_04 and JDK 1.5.0_05
// Win32
public final class X
{
private X() throws UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
public static void main(final String[] args) throws
TransformerException
{
final String xml = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><foo></foo>";
final String xsl = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><xsl:stylesheet
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
version=\"1.0\"><xslutput method=\"html\" indent=\"yes\"
doctype-public=\"-//W3C//DTD HTML 4.01 Transitional//EN\"
doctype-system=\"http://www.w3.org/TR/html4/loose.dtd\"/><xsl:template
match=\"/\"><html></html></xsl:template></xsl:stylesheet>";
final Writer w = new StringWriter();
final Transformer t =
TransformerFactory.newInstance().newTransformer(new StreamSource(new
StringReader(xsl)));
t.transform(new StreamSource(new StringReader(xml)), new
StreamResult(w));
System.out.println(w);
// expected
// <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
// actual (note the lack of a single space character)
// <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
}
}
Can anyone please confirm or otherwise, that the following source test
case produces unexpected behaviour? I have found nothing in the bug
parade thus far.
This code is also available at http://www.xdweb.net/~dibblego/X.java
Thanks for any pointers.
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerException;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.io.Writer;
import java.io.StringWriter;
import java.io.StringReader;
// JDK 1.5.0_04 and JDK 1.5.0_05
// Win32
public final class X
{
private X() throws UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
public static void main(final String[] args) throws
TransformerException
{
final String xml = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><foo></foo>";
final String xsl = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><xsl:stylesheet
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
version=\"1.0\"><xslutput method=\"html\" indent=\"yes\"
doctype-public=\"-//W3C//DTD HTML 4.01 Transitional//EN\"
doctype-system=\"http://www.w3.org/TR/html4/loose.dtd\"/><xsl:template
match=\"/\"><html></html></xsl:template></xsl:stylesheet>";
final Writer w = new StringWriter();
final Transformer t =
TransformerFactory.newInstance().newTransformer(new StreamSource(new
StringReader(xsl)));
t.transform(new StreamSource(new StringReader(xml)), new
StreamResult(w));
System.out.println(w);
// expected
// <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
// actual (note the lack of a single space character)
// <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
}
}