How to set ProcessingInstruction in jdom Document?  
Author Message
mali djuro





PostPosted: 2003-7-4 19:26:00 Top

java-programmer, How to set ProcessingInstruction in jdom Document? Hi all,
i try to make xml file with jdom, and also i made xsl file for presenting
xml in browser.
because of that i need to add processing instuction in xml file
...
<?xml-stylesheet type="text/xml" href="test.xsl" ?>
<root>
...
</root>

i did :

Element root = new Element("root");
Document document = new Document(root);

ProcessingInstruction pi = new ProcessingInstruction("xml-stylesheet",
"type='text/xsl' href='test.xsl'");

document.addContent(pi);

...

i got xml file like this

<?xml version=1.0 ?>
<root>
...
</root>
<?xml-stylesheet type="text/xsl" href="test.xsl" ?>

how to put this line
<?xml-stylesheet type="text/xsl" href="test.xsl" ?>
in front of <root>

thanks