when do I see this? XSLTProcessor processor XSLTProcessor processor

Discussion in 'Java' started by brahatha, Jun 13, 2007.

  1. brahatha

    brahatha Guest

    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();
    brahatha, Jun 13, 2007
    #1
    1. Advertising

  2. brahatha

    Guest

    On Jun 13, 5:28 pm, brahatha <> wrote:
    > 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();


    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
    , Jun 15, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gerry Viator
    Replies:
    3
    Views:
    563
    Gerry Viator
    Sep 29, 2003
  2. Andreas

    Designing a co-processor

    Andreas, Nov 5, 2003, in forum: VHDL
    Replies:
    0
    Views:
    438
    Andreas
    Nov 5, 2003
  3. YacentY
    Replies:
    11
    Views:
    2,469
    john jakson
    Dec 3, 2003
  4. Flip
    Replies:
    3
    Views:
    957
    Tony Morris
    Feb 9, 2004
  5. Steve Kershaw
    Replies:
    1
    Views:
    342
    Brennan Stehling
    Sep 26, 2006
Loading...

Share This Page