java源码
package jelly;
import java.io.FileWriter;
import java.io.Writer;
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.XMLOutput;
public class JellyTest {
public static void main(String args[]) throws Exception {
Writer someWriter = new FileWriter("C:/workspace/jackMoTool/output1.xml");
XMLOutput output = XMLOutput.createXMLOutput(someWriter);
// now run a script using a URL
JellyContext context = new JellyContext();
context.runScript("output.xml", output);
}
}
配置文件
//少了? 正确应该为 <?xml version="1.0"?>
<?xml version="1.0">
<j:jelly xmlns:j="jelly:core">
Hello World!
</j:jelly>
错误
log4j:WARN No appenders could be found for logger (org.apache.commons.jelly.JellyContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.commons.jelly.JellyException: null:-1:-1: <null> Could not parse Jelly script
at org.apache.commons.jelly.JellyContext.compileScript(JellyContext.java:547)
at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:678)
at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:668)
at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:621)
at jelly.JellyTest.main(JellyTest.java:16)
Caused by: org.xml.sax.SAXParseException: a pseudo attribute name is expected.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.jelly.parser.XMLParser.parse(XMLParser.java:254)
at org.apache.commons.jelly.JellyContext.compileScript(JellyContext.java:543)
... 4 more
Root cause
org.xml.sax.SAXParseException: a pseudo attribute name is expected.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.jelly.parser.XMLParser.parse(XMLParser.java:254)
at org.apache.commons.jelly.JellyContext.compileScript(JellyContext.java:543)
at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:678)
at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:668)
at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:621)
at jelly.JellyTest.main(JellyTest.java:16)