• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to load XML from classpath ?  RSS feed

 
Deepti Bhatia
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a requirement to load XML from the classpath. Could you please guide.
 
Deepti Bhatia
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have tried with ClassLoader.getSystemResourceAsStream but the value returned is alwayz null.
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're so very close - you should use getResourceAsStream, without the System part. Then it's just a matter of providing the right resource name.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!