xsl-list
[Top] [All Lists]

RE: Problem transforming a xml document

2003-03-14 06:16:16
It looks to me as if the system property
javax.xml.transform.TransformerFactory is set to null, so the system
doesn't know what XSLT processor you want to use.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Carlos Barroso
Sent: 14 March 2003 10:29
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Problem transforming a xml document


PLEASE HELP!

I'm having problems transforming a XML file. Here is the 
class source code. It's only a few lines:

//---------------------- CODE -------------------------

// ** import's **

public class GenerateHTML {
  public String process(String xmlString, String xslFile) 
throws TransformerConfigurationException, 
TransformerException, DocumentException, SAXException {

    ByteArrayOutputStream result = new ByteArrayOutputStream();

    SAXReader reader = new 
SAXReader("org.apache.xerces.parsers.SAXParser");
    Document document = reader.read(new InputSource(new 
StringReader(xmlString)));

    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(new 
StreamSource(new File(xslFile)));

    DocumentSource source = new DocumentSource(document);
    transformer.transform(source, new StreamResult(result));

    return(result.toString());
  }
}
//---------------------- END CODE -------------------------


I've tested the two parameters ("xmlString" and "xslFile") 
and they have the information that I want. I'm using this 
class inside a bean and every time I try to transform the 
generated XML (which is valid! I tested it with XML Spy 5) it 
keeps giving me the following error:

--------
javax.xml.transform.TransformerFactoryConfigurationError: 
Provider null could not be instantiated: 
java.lang.NullPointerException
      at javax.xml.transform.TransformerFactory.newInstance(Unknown
Source)
( ... )
--------

I can't figure out what the problem is!? I've never had this 
problem before.

Can someone help me please.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>