Here comes an example of using Tamino with Servlets and xerces:
xmlparser myParser = new xmlparser();
PrintWriter out = new PrintWriter(resp.getOutputStream());
String query = “…taminoQuery…”;
String xslDatei = “… name of xsl-File…”
String ErrorMsg=myParser.ParseXMLDocument(query, xslDatei, out);
class xmlparser contains method ParseXMLDocument:
import org.xml.sax.SAXException;
import org.apache.xalan.xslt.XSLTProcessorFactory;
import org.apache.xalan.xslt.XSLTInputSource;
import org.apache.xalan.xslt.XSLTResultTarget;
import org.apache.xalan.xslt.XSLTProcessor;
…
public String ParseXMLDocument ( String XML, String XSL,PrintWriter myPrintWriter ) {
try {
processor.process(new XSLTInputSource(XML), new XSLTInputSource(XSL),
new XSLTResultTarget(myPrintWriter));
return “”;
}
catch (Exception e) { processor.reset(); return e.toString(); }
Hope it helps!
Uli Licker
#Tamino#API-Management#webMethods