[jdom-interest] Passing JDOM to JAXP using SAX

Daniel Purucker dpu at daniel-purucker.de
Fri Apr 30 01:57:40 PDT 2004


Hi,
i want to transform an jdom-document with xslt. Because i'm not able to 
pass JDOM-Output directly to JAXP, i'm using the workaround proposed by 
Eric Burke, to transform JDOM into SAX.
That's the code, but i allway get wired error-messages...


public static SAXResult JDOMtoSAX(TransformerFactory transFact, String 
stylesheet, Result ergebnis) {

     if(transFact.getFeature(SAXTransformerFactory.FEATURE)) {
       SAXTransformerFactory stf = (SAXTransformerFactory) transFact;

       // "xsltTransform.java": cannot resolve symbol: method 
newTransformerHandler 	// (java.lang.String)in class 
javax.xml.transform.sax.SAXTransformerFactory       TransformerHandler 
transHand = stf.newTransformerHandler(stylesheet);
       transHand.setResult(ergebnis);
       // "xsltTransform.java": cannot resolve symbol: class 
SAXOutputter in class 	//xtree.xsltTransform at line 97, column 7
       SAXOutputter saxout = new SAXOutputter(transHand);
     }
     return saxout.output(jdomdoc);
}

What's wrong?
the "stylesheet" has to be an instance of 
"javax.xml.transform.Templates", but how do i create this?
Any help would be greatly appreciated. Thanx in advance,

Daniel




More information about the jdom-interest mailing list