<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>try the following program..</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>import org.xml.sax.InputSource;<BR>import 
java.io.FileReader;<BR>import org.w3c.dom.Document;<BR>import 
org.w3c.dom.Element;<BR>import org.w3c.dom.Node;<BR>import 
org.w3c.dom.NodeList;<BR>import org.apache.xerces.parsers.*; <BR>import 
org.apache.xerces.framework.*;<BR>import org.xml.sax.ErrorHandler; <BR>import 
org.xml.sax.helpers.DefaultHandler; <BR>import org.xml.sax.XMLReader; <BR>import 
org.xml.sax.SAXParseException;<BR>import org.xml.sax.SAXException;<BR>import 
org.xml.sax.SAXNotRecognizedException;<BR>import 
org.xml.sax.SAXNotSupportedException;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>public class ValidateWithSchema implements 
ErrorHandler<BR>{<BR>&nbsp;&nbsp;&nbsp; public void 
ValidateWithSchema()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp; public void warning(SAXParseException ex) 
<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("Warning");<BR>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; public void 
error(SAXParseException ex) <BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println(ex.getLineNumber()+":"+ex.getColumnNumber()+": "+"Error is 
:"+ex.getMessage());<BR>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; public void 
fatalError(SAXParseException ex) throws SAXException <BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Fatal 
Error");<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; public static void 
main(String argv[])<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ValidateWithSchema validate = new 
ValidateWithSchema();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XMLReader parser = 
null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parser = 
(XMLReader)Class.forName("org.apache.xerces.parsers.SAXParser").newInstance();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(Exception 
e)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("Error in 
Instantiating");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A 
href="file://parser.setContentHandler">file://parser.setContentHandler</A>(validate);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
parser.setErrorHandler(validate);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
parser.setFeature("http://xml.org/sax/features/validation", true); 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
parser.setFeature("http://xml.org/sax/features/namespaces", true); 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
parser.setFeature( "<A 
href='http://apache.org/xml/features/validation/schema",true'>http://apache.org/xml/features/validation/schema",true</A> 
);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
parser.parse(new InputSource(new 
FileReader(argv[0])));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("Validation&nbsp; 
:"+parser.getFeature("http://apache.org/xml/features/validation/schema"));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(SAXNotRecognizedException 
e)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
e.printStackTrace();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("False&nbsp;&nbsp; :Processing should be 
stopped1");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(SAXNotSupportedException 
e)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
e.printStackTrace();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("False&nbsp;&nbsp; :Processing should be 
stopped2");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(Exception 
e)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
e.printStackTrace();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("False&nbsp;&nbsp; :Processing should be 
stopped3");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; 
}&nbsp;&nbsp;&nbsp; <BR>} // class </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>regds</FONT></DIV>
<DIV><FONT face=Arial size=2>anoop singh</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A href="mailto:kissg@freemail.hu" title=kissg@freemail.hu>Kiss Gábor</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A 
  href="mailto:jdom-interest@jdom.org" 
  title=jdom-interest@jdom.org>jdom-interest@jdom.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, May 23, 2001 3:31 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [jdom-interest] W3C Schema 
  validation</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=Arial size=2>How can I use schema validation with Xerces? Is 
  there somewhere a useful documentation or turorial about it?</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I know it's not a real JDOM question, but I hope 
  I'll get an answer.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Thanks in advance,</FONT></DIV>
  <DIV><FONT face=Arial size=2>Gabor</FONT></DIV></BLOCKQUOTE></BODY></HTML>