Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 7673 invoked from network); 25 Jan 2000 16:26:00 -0000 Received: from unknown (HELO ns.spectral.se) (root@212.28.195.34) by 63.211.145.10 with SMTP; 25 Jan 2000 16:26:00 -0000 Received: from spectral.se (barnes.spectral.se [212.28.195.86]) by ns.spectral.se (8.9.3/8.8.7) with ESMTP id RAA15699 for ; Tue, 25 Jan 2000 17:31:25 +0100 Message-ID: <388D25FB.49ECB581@spectral.se> Date: Tue, 25 Jan 2000 05:26:35 +0100 From: Mats =?iso-8859-1?Q?Nor=E9n?= X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: general@xml.apache.org Subject: Re: Xalan + Xerces problem References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit The same result unfortunately... :-( Brian Dupras wrote: > > The row that seem to cause the problem is > > > > XSLTInputSource xmlID = new XSLTInputSource(doc); > > Just a guess, but try changing to : > > XSLTInputSource xmlID = new XSLTInputSource(doc.getDocumentElement()); > > > -----Original Message----- > > From: Mats Nor�n [mailto:mats.noren@spectral.se] > > Sent: Monday, January 24, 2000 8:51 PM > > To: general@xml.apache.org > > Subject: Xalan + Xerces problem > > > > > > Hi > > I've just started using xalan and xerces...my idea is to create a > > DOM-representation of various databasefields, do some calculations and > > then process them with xalan... > > Just to get started I rewrote some code from the xalandistribution and > > tried to process it, however it didn't succeed. > > When I run the class I get the following error: > > > > Exception in thread "main" DTMLiaison can not handle nodes of > > typeclass > > org.apache.xerces.dom.ElementImpl > > at org.apache.xalan.xslt.XSLTEngineImpl. > > at org.apache.xalan.xslt.XSLTEngineImpl. > > at org.apache.xalan.xslt.XSLTEngineImpl. > > > > at transform.main(transform.java:114) > > > > The code looks like this: > > > > import org.apache.xalan.xslt.XSLTProcessor; > > import org.apache.xalan.xslt.XSLTInputSource; > > import org.apache.xalan.xslt.XSLTResultTarget; > > import org.apache.xalan.xslt.XSLTProcessorFactory; > > import org.apache.xalan.xpath.XPathException; > > import org.apache.xalan.xslt.XSLTEngineImpl; > > > > import org.apache.xalan.xpath.xml.TreeWalker; > > import org.apache.xalan.xpath.xml.FormatterToXML; > > > > import org.apache.xerces.dom.*; > > > > import java.io.PrintWriter; > > import java.io.FileWriter; > > import java.io.BufferedReader; > > import java.io.FileReader; > > import java.io.Reader; > > import org.w3c.dom.*; > > import org.xml.sax.InputSource; > > import org.xml.sax.SAXException; > > > > public class test > > { > > public static void main(String[] args) > > throws java.io.IOException, > > java.net.MalformedURLException, > > org.xml.sax.SAXException > > { > > > > Document doc = new DocumentImpl(); > > Element el = doc.createElement("legend"); > > doc.appendChild(el); > > for (int i=0; i < 10; i++){ > > Element child = doc.createElement("text" + i); > > child.setAttribute("ID", "" + i); > > el.appendChild(child); > > } > > > > XSLTProcessor processor = XSLTProcessorFactory.getProcessor(); > > XSLTInputSource xmlID = new XSLTInputSource(doc); > > XSLTInputSource stylesheetID = new XSLTInputSource("test.xsl"); > > Document out = new DocumentImpl(); > > XSLTResultTarget resultTarget = new XSLTResultTarget(out); > > processor.process(xmlID, stylesheetID, resultTarget); > > > > PrintWriter pw = new PrintWriter( System.out ); > > FormatterToXML fl = new FormatterToXML(pw); > > TreeWalker tw = new TreeWalker(fl); > > tw.traverse(out); > > > > The row that seem to cause the problem is > > > > XSLTInputSource xmlID = new XSLTInputSource(doc); > > > > When I use the originalfrom with a reference to a file it works just > > fine... > > But I would like to create my own document within the class > > and not load > > it from file... > > > > Can anyone tell me how to do that ? > > > > /Mats > > > > > > > >