GeeCON Prague 2014*
The moose likes Java in General and the fly likes how to validate aXML file and store it in object using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "how to validate aXML file and store it in object using java" Watch "how to validate aXML file and store it in object using java" New topic
Author

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

kc pant
Greenhorn

Joined: May 10, 2011
Posts: 13
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

Joined: May 10, 2011
Posts: 13
please check it once guys...
kc pant
Greenhorn

Joined: May 10, 2011
Posts: 13
any help for any one...??
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14194
    
  20

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
kc pant
Greenhorn

Joined: May 10, 2011
Posts: 13
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


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to validate aXML file and store it in object using java