<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=413492114-11082005>This may be slightly
off topic for JDOM but I'm hoping its close enough. I've done the appropriate
GOOGLEing for the answer but just can't seem to figure it out.
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=413492114-11082005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=413492114-11082005>I am trying to
implement schema validation BUT my schema is on the file system, not on a web
server. I keep getting an error in the SAX parser, "no protocol" which I assume
means it can't find the schema (this could be an incorrect assumption but I
don't know at this point). Here is my code. I'm setting the variable, schemaURI,
to a URI like <A
href="file://c:/mySchema.xsd">file://c:/mySchema.xsd</A></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=413492114-11082005></SPAN></FONT><FONT
face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=413492114-11082005>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</SPAN></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2> SAXBuilder builder = new
SAXBuilder("org.apache.xerces.parsers.SAXParser");<BR>
builder.setValidation(true);<BR>
builder.setErrorHandler(new <SPAN
class=413492114-11082005>My</SPAN>SAXChecker());<SPAN class=413492114-11082005>
</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> // turn on schema
support<BR> builder.setFeature("<A
href="http://apache.org/xml/features/validation/schema">http://apache.org/xml/features/validation/schema</A>",
true);<BR> builder.setProperty("<A
href="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation">http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation</A>",
schemaURI);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> try
{<BR>
builder.build(xmlToValidate);<BR> }<BR>
catch (JDOMException e) {<BR>
System.out.println("Source xml is not
well-formed.");<BR>
System.out.println(e.getMessage());<BR>
}<BR> catch (IOException e)
{<BR> System.out.println("Could not get source
XML<SPAN class=413492114-11082005>: </SPAN>"<SPAN class=413492114-11082005> +
e.getMessage())</SPAN>;<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV>
<P style="MARGIN-BOTTOM: 0in"></P>
<P style="MARGIN-BOTTOM: 0in" align=left><FONT size=2><FONT
face=Arial>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR><STRONG><FONT color=#ff0000>Kevin L
Cobb, MT(ASCP), SCJP2<BR></FONT></STRONG>Senior Software Engineer<BR>Emergint,
Inc.<BR>2724 River Green Circle<BR>Louisville, KY 40206<BR></FONT></FONT><A
href="mailto:Kevin.Cobb@emergint.com"><FONT size=2><FONT
face=Arial>Kevin.Cobb@emergint.com</FONT></FONT></A><BR><FONT size=2><FONT
face=Arial>502.896.6210 ext 255<BR>502.896.6170 fax</FONT></FONT></P>
<P style="MARGIN-BOTTOM: 0in"> </P>
<P style="MARGIN-BOTTOM: 0in"><FONT face=Arial><FONT size=2>The preceding e-mail
message and attachments, if any, contains information that is confidential and
qualifies as such under the Definition of Confidential Information in the
Non-Disclosure Agreement, and may constitute non-public information and trade
secrets. It is intended to be conveyed only to the designated recipient(s). If
you are not an intended recipient of this message, please notify the sender at
502.896.6210. </FONT></FONT></P>
<DIV> </DIV></BODY></HTML>