[jdom-interest] Outputting PIs

Muhle, Daniel Daniel.Muhle at mettenmeier.de
Thu Nov 30 00:47:16 PST 2000

Hi there,

I just stumbled about a strange behaviour of the XML-Outputter.

After I've created a new document with:
      Namespace ns = Namespace.getNamespace("MM",
      Element root = new Element("Data_Model", ns);
      doc = new Document(root);

      Hashtable PIValues = new Hashtable();
      PIValues.put("href", "XSL\\GisModel.html.xsl");
      PIValues.put("type", "text/xsl");
and added this PI and a DTD

      ProcessingInstruction pi = new ProcessingInstruction(

      doc.setDocType(new DocType("MM:Data_Model", "DTD/data_model.dtd"));

Then I'm populating the document with more Elements and finally print it to
a file using the XMLOutputter:

	XMLOutputter fmt = new XMLOutputter("   ", true,"ISO-8859-1");

But when I take a look at the output I have to see, that the added PI has
been appended to the end of my document.

	<?xml version="1.0" encoding="ISO-8859-1"?>
	<!DOCTYPE MM:Data_Model SYSTEM "DTD/data_model.dtd">
	<MM:Data_Model xmlns:MM="http://www.mettenmeier.de">

		< ... a lot of elements... />
	<?xml-stylesheet href="XSL\GisModel.html.xsl" type="text/xsl"?>

The Apache-Coocoon-Framework doesn't like a PI at the end of a document,
though... ;-)

> Mit freundlichen Grüßen:
> Daniel Muhle
> Mettenmeier GmbH
> -Abteilung Software-
> mailto:daniel.muhle at mettenmeier.de
> http://www.mettenmeier.de

More information about the jdom-interest mailing list