<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.00.2919.6307" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=185453921-16022001>actually, this code works just fine. I caught an
invalid xml (do dtd) and worked with xml with a valid dtd. It must be a
setup issue. As usual, check your classpath, file path etc. and of course
the dreaded "xml parsers in the jre/lib/ext" directory</SPAN></FONT></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">
<DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Peoter Veliki
[mailto:peoter_veliki@hotmail.com]<BR><B>Sent:</B> Friday, February 16, 2001
3:22 PM<BR><B>To:</B> GB/DEV - Philip Nelson;
jdom-interest@jdom.org<BR><B>Subject:</B> Re: [jdom-interest] verify document
with JDom?<BR><BR></DIV></FONT>
<DIV><FONT face=Arial size=2>I'm giving that a shot, the problem is that it is
hanging when I try to instantiate a SAXBuilder. Any idea why it would
hang? This program below will never exit.</FONT></DIV><FONT face=Arial
size=2>
<DIV><BR>import java.io.*;<BR>import java.util.*;<BR>import
org.jdom.*;<BR>import org.jdom.input.*;<BR>import org.jdom.output.*;</DIV>
<DIV> </DIV>
<DIV><BR>public class XMLVerify{<BR> public static void main(String
args[]){<BR> String fileName =
"/home/peterb/Gateway/creditscoreRequest.xml";<BR> Document xmlDoc
= buildDoc(fileName);<BR> }</DIV>
<DIV> </DIV>
<DIV> public static Document buildDoc(String
fileName){<BR> try{<BR> // Build the document with
SAX and Xerces, with validation<BR> SAXBuilder builder = new
SAXBuilder(true);<BR> // create and return the
document<BR> return builder.build(new
File(fileName));<BR> }catch(Exception
e){<BR> e.printStackTrace();<BR> return
null;<BR> }<BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </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:philip.nelson@omniresources.com"
title=philip.nelson@omniresources.com>GB/DEV - Philip Nelson</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> Friday, February 16, 2001 1:11
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [jdom-interest] verify
document with JDom?</DIV>
<DIV><BR></DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=787301421-16022001>When you parse the document, you can have the
parser validate against the DTD. There is not however a method to
validate a JDOM Document instance against a DTD so just use the validate
flag on your builder and you will know you have a valid document coming
in.</SPAN></FONT> </BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>