As you know that The Resource Description Framework is used to represents the information, so the particular RDF Example is written to explain you how to read the RDF files in Java. In the next example you will be learning about writing a RDF file in Java. But first lets see how to read it..?
To read and show the data of RDF/XML file on command prompt, just follow the given example. It is going to read a RDF/XML file and then its content will be shown on command prompt.
To read RDF/XML file we do have need an object of Model interface. It takes two arguments :
File which is to be read is being get by FileInputStream class constructor. Then read(in,"") method reads all file.
Our XML file will look like this.
To run this example:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: September 27, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles