[jdom-interest] Include a PI when building a JDOM doc?
    Alex Rosen 
    arosen at novell.com
       
    Thu Mar 13 08:25:02 PST 2003
    
    
  
It probably is there but it's at the end. See the JDOM FAQ, it tells
you how to add it to the beginning.
Alex
>>> "Rob Mitchell" <rjmitchell at attbi.com> 3/13/2003 8:17:01 AM >>>
 ProcessingInstruction pi = new ProcessingInstruction("xml-stylesheet",
"type=\"text/xsl\" href=\"/ssi/TestExp.xsl\"");
 jdomDoc.addContent(pi);
But it still doesn't appear in the output
 XMLOutputter xmlOut = new XMLOutputter("  ", true);
 xmlOut.setTextNormalize(true);
 // if I uncomment next line, it appears fine
 //xmlOut.output(pi, response.getOutputStream());
 xmlOut.output(jdomDoc, response.getOutputStream());
Basically, my server is receiving an HTTP request, servicing the
request via a DB query and using those results to filter a static XML
doc (a periodic data extract) then using JDOM to produce an XML document
via a custom ContentHandler and SAX.
I then created an XSL stylesheet for the new JDOM doc
I then forward the HTTP request to a JSP that's declared to produce XML
output.
I want the response then handled by IE to render the XML/XSL into HTML
Everything works, except for putting the PI into the JDOM when the doc
is first created.  Any ideas?
Thanks!
_______________________________________
Rob Mitchell
Base Class Technologies, Inc.
Java, WebSphere, Domino, Oracle, Web development
rjmitchell at attbi.com 
  ----- Original Message ----- 
  From: Rob Mitchell 
  To: jdom-interest at jdom.org 
  Sent: Wednesday, March 12, 2003 4:23 PM
  Subject: [jdom-interest] Include a PI when building a JDOM doc?
  Hi,
  Can anyone answer this please?
  Element elemRoot = new Element("ExpenseReports");
  jdomDoc = new Document(elemRoot);
  //<xsl:stylesheet version="1.0" xmlns:xsl="MyExpenseReport.xsl">
  jdomDoc.addContent(new ProcessingInstruction("",""));
  How do I put the processing instruction for the XSL stylesheet into
the JDOM doc? We want the user's browser to render the XML/XSL into
HTML. 
  TIA!
  _______________________________________
  Rob Mitchell
  Base Class Technologies, Inc.
  Java, WebSphere, Domino, Oracle, Web development
  rjmitchell at attbi.com 
    
    
More information about the jdom-interest
mailing list