[jdom-interest] newbie jdom -> xalan problem

Alan Eustace alan.eustace at bigfoot.com
Thu Apr 5 09:03:51 PDT 2001


this is pretty basic, I'm sure, but I get the following error when i try to compile
XSLTransform:

d:\jdom-xslt\org\jdom\contrib\transform\JDOMResult.java:160: org.jdom.input.SAXHandler
is not public in org.jdom.input; cannot be accessed from outside package
    private SAXHandler saxHandler = null;

I have my classpath set up to use JDOM and Xalan, but amn't sure what I'm doing wrong
here.
Alan

Jason Hunter wrote:

> What happens using the new FAQ entry (suggesting JDOMSource/JDOMResult)?
>
> -jh-
>
> Alan Eustace wrote:
> >
> > I'd be very grateful if someone can shed any light on this;
> > I'm processing xml in a servlet, using piped streams as per the jdom faq
> > of about a month ago.
> > The parser hangs at the  "xmlOutputter.output( doc, pout );" line. I had
> > a similar problem before, which was to do
> > with not closing the piped output stream: adding the close() call solved
> > that, but I'm baffled by this problem. No exception is being thrown.
> >
> > Many thanks,
> > Alan Eustace.
> >
> > import java.io.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> > import java.util.*;
> > import org.jdom.Document;
> > import org.jdom.Element;
> > import org.jdom.input.*;
> > import org.jdom.output.*;
> > import org.jdom.input.SAXBuilder;
> > import org.jdom.output.XMLOutputter;
> >
> > // Xalan-J 2
> > import javax.xml.transform.Result;
> > import javax.xml.transform.Source;
> > import javax.xml.transform.Templates;
> > import javax.xml.transform.Transformer;
> > import javax.xml.transform.TransformerFactory;
> > import javax.xml.transform.stream.StreamSource;
> > import javax.xml.transform.stream.StreamResult;
> >
> > public class JDOMXalan extends HttpServlet{
> >
> >   PrintWriter out;
> >   Element msg;
> >   Document xmldoc;
> >   Transformer processor;
> >
> >   public void init(ServletConfig config)throws ServletException{
> >               super.init(config);
> >
> >             try{
> >
> >               File xslt = new File("foo.xsl");
> >               SAXBuilder builder = new SAXBuilder();
> >               xmldoc = builder.build(new File("foo.xml"));
> >               Element root = xmldoc.getRootElement();
> >               msg = root.getChild("message");
> >               TransformerFactory transformerFactory =
> > TransformerFactory.newInstance();
> >               Templates stylesheet = transformerFactory.newTemplates(new
> > StreamSource( xslt ) );
> >               processor = stylesheet.newTransformer();
> >
> >             }
> >             catch (Exception j){
> >                   j.printStackTrace();
> >             }
> >   }
> >
> >   public void doGet(HttpServletRequest req, HttpServletResponse
> > res)throws
> >   ServletException, IOException{
> >         out = res.getWriter();
> >         res.setContentType("text/html");
> >
> >       try{
> >
> >       PipedInputStream in = new PipedInputStream();
> >       PipedOutputStream pout  = new PipedOutputStream( in );
> >       StreamSource source = new StreamSource( in );
> >       StreamResult outsource = new StreamResult (out);
> >
> >       XMLOutputter xmlOutputter = new XMLOutputter();
> >        //***parser hangs here***
> >       xmlOutputter.output( xmldoc, pout  );
> >
> >       pout.close();
> >       processor.transform( source, outsource );
> >       }
> >       catch (Exception e) {
> >          e.printStackTrace();
> >       }
> >   }
> > }
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com




More information about the jdom-interest mailing list