Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

when do I see this? XSLTProcessor processor XSLTProcessor processor

Thread view: 
brahatha - 13 Jun 2007 22:28 GMT
I have the following lines of code.

import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import org.xml.sax.SAXException;
import org.apache.xalan.*;

public class ReadXslt {

    public static void main (String[] args) throws MalformedURLException,
SAXException  {

        XSLTProcessor processor = null;
        String xmlFileName = "test.xml";
           String xsltFileName = "Read-Cdata.xslt";

        String xmlSystemId = new
File(xmlFileName).toURL().toExternalForm( );
         String xsltSystemId = new
File(xsltFileName).toURL().toExternalForm( );

         processor= XSLTProcessorFactory.getProcessor();

    }//end of main

}//end class

What is causing this error

ReadXslt.java:13: cannot find symbol
symbol  : class XSLTProcessor
location: class ReadXslt
               XSLTProcessor processor = null;
               ^
ReadXslt.java:20: cannot find symbol
symbol  : variable XSLTProcessorFactory
location: class ReadXslt
               processor= XSLTProcessorFactory.getProcessor();
wisccal@googlemail.com - 15 Jun 2007 11:52 GMT
> I have the following lines of code.
>
[quoted text clipped - 35 lines]
> location: class ReadXslt
>                 processor= XSLTProcessorFactory.getProcessor();

Check out this thread:
http://forum.java.sun.com/thread.jspa?threadID=492221&messageID=3017648

You are using old classes. You need to convert your code as follows:

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

...

TransformerFactory tFactory = TransformerFactory.newInstance();
Source xslSource = new StreamSource( "Read-Cdata.xsl" );
Transformer transformer = tFactory.newTransformer( xslSource );
transformer.transform( new StreamSource("test.xml"),new
StreamResult(System.out)); //Transformed file to standard out.

...

Regards,
Steve
------------------
www.stkomp.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.