Sax parser.parse() when the argument is in a jar file

R

RVic

If I have an xml file in a jar, and I want to use the Sax parser to
read it in, how do I specify this? Thanks RVic
 
A

Arne Vajhøj

RVic said:
If I have an xml file in a jar, and I want to use the Sax parser to
read it in, how do I specify this? Thanks RVic

Something like:

SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
xr.parse(new InputSource(getClass().getResourceAsStream("/foo/bar.xml")));

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top