You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by joe kim <jo...@gmail.com> on 2006/06/28 03:52:33 UTC

Getting started with Abdera

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

Any thoughts?  Are there plans to use other parsers such as JDOM?

Joe

Re: Getting started with Abdera

Posted by James M Snell <ja...@gmail.com>.
I'm giving some thought to this as we need something along these lines
for JSON/RDF conversions.  I'll see if I can post some additional
information in the coming few days.

- James

Garrett Rooney wrote:
> On 6/28/06, joe kim <jo...@gmail.com> wrote:
> 
>> You are right, I got it wrong.  But, what is the advantage of only
>> pulling files from the classpath?
> 
> The advantage is that the example is self contained ;-)
> 
>> > Yep, although the barrier is a bit high.  The FOM* impl classes are
>> > dependent on the Axiom implementation.  So you either implement JDOM as
>> > a layer under Axiom or create a JDOM-based impl of the FOM* classes.
>>
>> Sounds quite involved.  Are there no Atom model pojo's that can just
>> be populated with data by some arbitrary code?
> 
> Currently, not that I'm aware of, at least not in Abdera's codebase.
> 
> -garrett
> 

Re: Getting started with Abdera

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 6/28/06, joe kim <jo...@gmail.com> wrote:

> You are right, I got it wrong.  But, what is the advantage of only
> pulling files from the classpath?

The advantage is that the example is self contained ;-)

> > Yep, although the barrier is a bit high.  The FOM* impl classes are
> > dependent on the Axiom implementation.  So you either implement JDOM as
> > a layer under Axiom or create a JDOM-based impl of the FOM* classes.
>
> Sounds quite involved.  Are there no Atom model pojo's that can just
> be populated with data by some arbitrary code?

Currently, not that I'm aware of, at least not in Abdera's codebase.

-garrett

Re: Getting started with Abdera

Posted by joe kim <jo...@gmail.com>.
 > Yep. I've seen this on several occasions and it always happens on a null
> stream.  We need to add some error checking on that

I saw the patched.  That's quick.

> > 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.

You are right, I got it wrong.  But, what is the advantage of only
pulling files from the classpath?

> Yep, although the barrier is a bit high.  The FOM* impl classes are
> dependent on the Axiom implementation.  So you either implement JDOM as
> a layer under Axiom or create a JDOM-based impl of the FOM* classes.

Sounds quite involved.  Are there no Atom model pojo's that can just
be populated with data by some arbitrary code?

Joe

Re: Getting started with Abdera

Posted by James M Snell <ja...@gmail.com>.

Garrett Rooney wrote:
>[snip]
> 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:
> 

Yep. I've seen this on several occasions and it always happens on a null
stream.  We need to add some error checking on that

> 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.
> 

Yep, although the barrier is a bit high.  The FOM* impl classes are
dependent on the Axiom implementation.  So you either implement JDOM as
a layer under Axiom or create a JDOM-based impl of the FOM* classes.

> -garrett
> 

Re: Getting started with Abdera

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 6/27/06, joe kim <jo...@gmail.com> 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