Sorry, this question has been answered elsewhere but I'm having difficulty understanding most of them as they're asking an underlying question or I'm unsure of what's going on.
I'm planning on using JAXB to get some XML into a Java object. Commonly examples show the typical:
File file = new File("their.xml");
I, however am retrieving my XML online from a url as opposed to a file on the system.
Take this example:
File file = new File( "countries.xml" ); JAXBContext jaxbContext = JAXBContext.newInstance( Countries.class );` Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();` Countries countres = (Countries)jaxbUnmarshaller.unmarshal( file ); System.out.println( countres );
I need to be able to do something like this but instead with a url. Can anyone advise or provide an example, it would be much appreciated.
No comments:
Post a Comment