[jdom-interest] verify document with JDom?
Peoter Veliki
peoter_veliki at hotmail.com
Fri Feb 16 13:22:13 PST 2001
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.
import java.io.*;
import java.util.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
public class XMLVerify{
public static void main(String args[]){
String fileName = "/home/peterb/Gateway/creditscoreRequest.xml";
Document xmlDoc = buildDoc(fileName);
}
public static Document buildDoc(String fileName){
try{
// Build the document with SAX and Xerces, with validation
SAXBuilder builder = new SAXBuilder(true);
// create and return the document
return builder.build(new File(fileName));
}catch(Exception e){
e.printStackTrace();
return null;
}
}
}
----- Original Message -----
From: GB/DEV - Philip Nelson
To: jdom-interest at jdom.org
Sent: Friday, February 16, 2001 1:11 PM
Subject: RE: [jdom-interest] verify document with JDom?
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010216/81c849d2/attachment.htm
More information about the jdom-interest
mailing list