What is wrong with my XSLProcessor?

Discussions

XML & Web services: What is wrong with my XSLProcessor?

  1. What is wrong with my XSLProcessor? (4 messages)

    Hi,
    I am trying to transforming XML into HTML at the server side. I'm using the following code:

    com.lotus.xml.xml4j2dom.XML4JLiaison4dom pl = new com.lotus.xml.xml4j2dom.XML4JLiaison4dom();

    com.lotus.xsl.XSLProcessor processor = new com.lotus.xsl.XSLProcessor(pl);

    InputSource xmlSource = new InputSource(new ByteArrayInputStream(xml.getBytes()));

    File xslFile = new File(stylesheetLocation);
    InputSource xslSource = new InputSource(new FileInputStream(xslFile));

    com.lotus.xsl.XSLTResultTarget xsltresult = new XSLTResultTarget(results);

    processor.process(xmlSource, xslSource, xsltresult);

    Where xml is a string containing the xml input, and stylesheetLocation is the path of the xsl file. I got javax.xml.transform.TransformerException: SAX Exception, can someone tell me what is wrong here??

    Many thanks!

    Hilary

    Threaded Messages (4)

  2. What is wrong with my XSLProcessor?[ Go to top ]

    Can you provide the error message / stack trace of the SAXException? (Or at least that part of the stack trace which is relevant, if you don't want to give away information). A "SAXException" is pretty broad and can mean almost anything. To quote the documentation:

    "
    public class SAXException extends java.lang.Exception

    Encapsulate a general SAX error or warning.

    This class can contain basic error or warning information from either the XML parser or the application: a parser writer or application writer can subclass it to provide additional functionality. SAX handlers may throw this exception or any exception subclassed from it.
    "
  3. Oops! TransformException[ Go to top ]

    Oops! Sorry, I should have read your message more carefully before replying: I see that you actually got a TransformerException with the description "SAX Exception". It would still be useful to have a stack trace, though; the documentation for TransformerException is even more vague:

    "
    public class TransformerException extends Exception

    This class specifies an exceptional condition that occured during the transformation process.
    "

    You might also try calling getCause() on the exception and see if it returns further description.

  4. Oops! TransformException[ Go to top ]

    Thanks James!

    Actually I think the problem is in somewhere else. I tried a very simple sample code from lotusxsl, something like this:

    XSLProcessor processor = new XSLProcessor();
    processor.process(
        new XSLTInputSource("foo.xml"),
        new XSLTInputSource("foo.xsl"),
        new XSLTResultTarget("foo.txt"));

    It ran ok in the DOS command shell, or Visual J++, but when I ran it in JCreator, Eclipse, I got this error:

    ==== simpleTransform ====
    SystemId Unknown; Line 0; Column 0; javax.xml.transform.TransformerException: SAX Exception
    at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1496)
    at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1461)
    at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:511)
    at com.lotus.xsl.XSLProcessor.process(XSLProcessor.java:189)

    I had the same classpaths and the classes are in the same sequence. What could be wrong?

    Thanks again!
  5. XML to XSL[ Go to top ]

    This is the exception I received, when trying to format xml string using xsl.
    I am using Websphere Server 4.0
    can anyone help?
    SystemId Unknown; Line 0; Column 0; SystemId Unknown; Line 0; Column 0; javax.xml.transform.TransformerException: SAX Exception
    at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1542)
    at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1507)
    at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:531)