This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

path for xml file

 
Sebastian Green
Ranch Hand
Posts: 136
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Vladas Razas
Ranch Hand
Posts: 385
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you put your xml on web server?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic