On 6/27/06, joe kim <[EMAIL PROTECTED]> wrote:
I setup an eclipse workspace and checked out the abdera code from SVN.
I had some trouble running the example class
org.apache.abdera.examples.simple.Parse. I made sure that the String
passed to getResourceAsStream() was a valid path to "simple.xml". Here
is the error I had:
Exception in thread "main" org.apache.abdera.parser.ParseException:
java.lang.NullPointerException
at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:74)
at org.apache.abdera.util.AbstractParser.parse(AbstractParser.java:41)
at org.apache.abdera.examples.simple.Parse.main(Parse.java:33)
Caused by: java.lang.NullPointerException
at
com.ctc.wstx.io.StreamBootstrapper.initialLoad(StreamBootstrapper.java:457)
at
com.ctc.wstx.io.StreamBootstrapper.resolveStreamEncoding(StreamBootstrapper.java:217)
at
com.ctc.wstx.io.StreamBootstrapper.bootstrapInput(StreamBootstrapper.java:103)
at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:533)
at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:521)
at
com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:266)
at
org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:61)
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.<init>(StAXOMBuilder.java:96)
at org.apache.abdera.parser.stax.FOMBuilder.<init>(FOMBuilder.java:116)
at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:70)
... 2 more
That kind of error tends to result from passing a null stream to
parse(). When you say that the path to simple.xml was "valid", do you
mean you gave it a full system path, like:
InputStream in = Parse.class.getResourceAsStream("/home/rooneg/.../simple.xml");
If so, that's incorrect, getResourceAsStream tries to pull a file out
of the classpath, so you need to make sure a directory containing that
file (i.e. the resources directory, or someplace the contents of that
directory are copied) is in the classpath when you run the test.
Any thoughts? Are there plans to use other parsers such as JDOM?
I don't know, do you plan to write a parser that uses JDOM? ;-)
Seriously, as I understand it, Abdera is written in such a way as to
allow multiple parser back ends, so the only limitation is the lack of
volunteers to write parser back ends for whatever kind of XML parser
is desired.
-garrett