• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading XML using the XSD schema file.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

I am a new bie to XML. Please suggest me some ways to read an XML file given an XSD schema file.

Thanks and Regards,
Krishnan Sreeraman.
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You can use Java and XML Binding APIs like JAXB APIS.
As you have the XSD file you can run XJC compiler and generate the Java Objects corresponding to your XML Schema.
Once done un-marshal the XML file to populate Java Tree structure from the XML input.

You can also use Castor APIs which is similar to JAXB.

Regards,
amit
 
Ranch Hand
Posts: 30
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Krishnan,

It seems that you want to read the contents of an XML file and display the text of each element.

If this is the case than follw this steps:

Step I : Download dom4j.jar and place this into the classpath.

Step II : Suppose the XML file is testing.xml in the test folder of your C drive.
testing.xml


Step III: The Code snippet for ReadXml.java


Hope this will solve your problem.



 
I am going to test your electrical conductivity with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic