Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] SaxBuilder error: root element missing

Bill Woodward

2003-10-08

Replies:

Emmanuel Gilmont said:
>
> //- this doesn't work
> SaxBuilder sb = new SaxBuilder();
> Document doc = sb.build(getClass().getResource("/ressources/tpc.xml"));
>

Are you sure that the URL you are getting is good? For what it's worth ,
the code I use to get a URL to an XML file in a jar is and build a JDOM
tree with it is:

URL schemaUrl =
  Thread.currentThread().getContextClassLoader().getResource
    ("META-INF/ObjectSchema.xml");
Reader schemaReader = new InputStreamReader(schemaUrl.openStream());
sb.build(schemaReader);

- Bill


   /------------------------------------\
  /  Bill Woodward (wpwood@(protected))  \
  \     http://www.saifa.net       /
   \------------------------------------/
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.