A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
XML and Related Technologies
How can i validate?
Joined: Aug 29, 2006
Sep 23, 2006 07:02:00
How can I parse a XML, validating it to the XSD using SAX parser?
Thank you,<br /> <br />Suhas K Madap<br /> <br />If you understand what you're doing, you're not learning anything."
Joined: May 11, 2005
Sep 27, 2006 07:00:00
I would suggest getting a good textbook, "Java & XML" (2nd edition) by Brett McLaughlin is an excellent introduction to XML handling with
As a quick intro, you need to :
1) Create an XML reader using SAX factory method
2) Define a class that implements the
interface and register an instance of that class with the reader.
3) Create an
that points to the XML file to parse
final InputSource xmlSource = new InputSource(new FileReader(xmlFile));
4) Set the appropriate features on the parser to turn on validation eg
5) Call parse() on the reader, all event will then be sent to the object that you registered as the contentHandler.
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank" rel="nofollow">Use Code Tags!!</a>
It is sorta covered in the
JavaRanch Style Guide
subject: How can i validate?
Hide Standart Buttons in Taskbar
ConnectionFactory lookup returns null
Increase memory for tomcat
I've bought Sybex Java 2 Certification Virtual Trainer
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014