aspose file tools*
The moose likes XML and Related Technologies and the fly likes path for xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "path for xml file" Watch "path for xml file" New topic
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
    
    5
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