Hi all,I write an agent to transform XML data using XSL form like this:
import lotus.domino.*;
import com.lotus.xsl.*;
import com.lotus.xml.xml4j2dom.*;
import com.lotus.xsl.XSLTInputSource;
import com.lotus.xsl.XSLTResultTarget;
import java.io.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
XSLProcessor xp = new XSLProcessor(new XML4JLiaison4dom());
String x = "http://servername/TestDB.nsf/source.xml?OpenPage";
String s = "http://servername/TestDB.nsf/source.xsl?OpenPage";
StringWriter rw = new StringWriter();
XSLTInputSource xsrc = new XSLTInputSource(x);
XSLTInputSource ssrc = new XSLTInputSource(s);
XSLTResultTarget tout = new XSLTResultTarget(rw);
xp.process(xsrc,ssrc,tout);
getAgentOutput().println("Content-type: text/html");
getAgentOutput().println(rw.toString());
} catch(Exception e) {
getAgentOutput().println("Content-type: text/html");
getAgentOutput().println("<html><head><title>Agent Error</title></head><body>");
getAgentOutput().println(e);
getAgentOutput().println("</body></html>");
}
}
}
but when I run on local (that mean servername=localhost), it works but when I copy this database to server and change servername, an error occured.
HTTP JVM: XSL Error: SAX Exception
and on browser, an information “Whitespace expected.” is shown.
So, anyone know how to solve this problem, please help me.
Thank in advance,
Trung