XSLT transformation with a xindice result

"Pasche" <[email protected]>
Newsgroups gmane.text.xml.xindice.user
Message-ID <[email protected]>
I try to transform a XML document  I get from the xindice database. First of
all, I transform the result of the xpath query into a DOMSource. Then I try
to transform this DOMSource with the help of a xslt stylesheet. But I can´t
even compile it (see errors below). I have no idea why I get the “cant
resolve symbol” error. I think I included all classes.

 

 

<%@ page import="org.xmldb.api.base.*" %>

<%@ page import="org.xmldb.api.modules.*" %>

<%@ page import="org.xmldb.api.*" %>

<%@ page import="org.w3c.dom.*" %>

<%@ page import="javax.xml.transform.dom.*" %>

<%@ page import="javax.xml.transform.stream.*" %>

 

String suche = request.getParameter("suchbegriff");

Collection col = null;

      try {

         String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";

         Class c = Class.forName(driver);

 

         Database database = (Database) c.newInstance();

         DatabaseManager.registerDatabase(database);

 

         col =
DatabaseManager.getCollection("xmldb:xindice://83.137.103.78:8080/db/wikiped
ia");

 

         String xpath = "/output/ART/A0[SSTW='" + suche + "']";

         DOMSource src = null;

         

         XPathQueryService service =

            (XPathQueryService) col.getService("XPathQueryService", "1.0");

         ResourceSet resultSet = service.query(xpath);

         ResourceIterator results = resultSet.getIterator();

         while (results.hasMoreResources()) {

            XMLResource res = (XMLResource) results.nextResource();

            Node node = res.getContentAsDOM();   

            src = new DOMSource(node);         

         }

         

         

         

         // Generate a Transformer.

 
javax.xml.transform.Transformer transformer = Factory.newTransformer

                  (new javax.xml.transform.stream.StreamSource("pml.xsl"));

                                                                       

                                                // Create an empy DOMResult
object for the output.

 
javax.xml.transform.dom.DOMResult domResult = new
javax.xml.transform.dom.DOMResult();

 

                                                // Perform the
transformation.

                                                transformer.transform(new
javax.xml.transform.dom.DOMSource(src));

 

                                                // Now you can get the
output Node from the DOMResult.

                                                org.w3c.dom.Node output =
domResult.getNode();

                                                Result res = new
StreamResult(output);

 

 
out.println(res.getOutputStream());

      }

      catch (XMLDBException e) {

         System.err.println("XML:DB Exception occurred " + e.errorCode);

      }

      finally {

         if (col != null) {

            col.close();

         }

      }

 

 

Generated servlet error: 
[javac] Since fork is true, ignoring compiler setting. 
[javac] Compiling 1 source file 
[javac] Since fork is true, ignoring compiler setting. 
[javac] D:\tomcat\work\Standalone\localhost\web\ergebnis_jsp.java:127:
cannot resolve symbol 
[javac] symbol : variable Factory 
[javac] location: class org.apache.jsp.ergebnis_jsp 
[javac] javax.xml.transform.Transformer transformer = Factory.newTransformer

[javac] ^ 
[javac] D:\tomcat\work\Standalone\localhost\web\ergebnis_jsp.java:134:
cannot resolve symbol 
[javac] symbol : constructor DOMSource (javax.xml.transform.dom.DOMSource) 
[javac] location: class javax.xml.transform.dom.DOMSource 
[javac] transformer.transform(new javax.xml.transform.dom.DOMSource(src)); 
[javac] ^ 
[javac] D:\tomcat\work\Standalone\localhost\web\ergebnis_jsp.java:138:
cannot resolve symbol 
[javac] symbol : class ResultSet 
[javac] location: class org.apache.jsp.ergebnis_jsp 
[javac] ResultSet res = new StreamResult(output); 
[javac] ^ 
[javac] D:\tomcat\work\Standalone\localhost\web\ergebnis_jsp.java:138:
cannot resolve symbol 
[javac] symbol : constructor StreamResult (org.w3c.dom.Node) 
[javac] location: class javax.xml.transform.stream.StreamResult 
[javac] ResultSet res = new StreamResult(output); 
[javac] ^ 
[javac] 4 errors
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.