Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to validate aXML file and store it in object using java

 
kc pant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,


i got a new assignment , i have to validate a XML file and also i have to make a program to store its values in a java object. we are using SAX parser for parsing

thanks in advance

kc

 
kc pant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please check it once guys...
 
kc pant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any help for any one...??
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

How far are you already with the assignment; can you read the file already with a SAX parser? If your question is on how to do validation against an XSD, then you can find information and examples for that on the web, for example: The Java XML Validation API.

How to store the values in a Java object depends on exactly what Java object you have. When you use a SAX parser you'll somewhere have a method that you write yourself that gets called when the parser encounters the content of a tag, and there you'll be able to do something with that content, such as storing it in an object somewhere.

Please note, patience is a virtue.
 
kc pant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jesper,

first of all Thanks for Welcoming me...
and second thanks for reply...


yes i am able to read the xml but i dont know how to validate. so i will check it by your given link.


thanks again


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic