| Author |
path for xml file
|
Sebastian Green
Ranch Hand
Joined: Jan 30, 2004
Posts: 136
|
|
|
I have tired both SAX & JAXP to parse xml-files. It works fine if give the parser an absolute path to file (C:\\demo.xml). But what I really want to is give a an url (http://localhost/demo.xml). Is it possible for an more dynamic sollution then the first case?
|
/ Sebastian<br />No blog, No homepage, No life?
|
 |
Vladas Razas
Ranch Hand
Joined: Dec 02, 2003
Posts: 385
|
|
|
Have you put your xml on web server?
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
Originally posted by Sebastian Green: I have tired both SAX & JAXP to parse xml-files. It works fine if give the parser an absolute path to file (C:\\demo.xml). But what I really want to is give a an url ( http://localhost/demo.xml). Is it possible for an more dynamic sollution then the first case?
Make your API to take the XML as a java.io.InputStream instead of File or String. Then, if you need to parse a local file, pass in a new FileInputStream("C:\\demo.xml"), and when you need to parse a remote file on a web server, pass in new URL("http://localhost/demo.xml").openStream().
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
 |
|
|
subject: path for xml file
|
|
|