[jdom-interest] verify document with JDom?

Peter Bismuti peterb at pssg.com
Fri Feb 16 13:50:50 PST 2001


Actually, what I said was not quite true.  It doesn't hang if I take out the DOCTYPE statement.  If I leave it in, it will hang with or without validation.  
  ----- Original Message ----- 
  From: GB/DEV - Philip Nelson 
  To: 'Peoter Veliki' ; jdom-interest at jdom.org 
  Sent: Friday, February 16, 2001 1:37 PM
  Subject: RE: [jdom-interest] verify document with JDom?


  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
    -----Original Message-----
    From: Peoter Veliki [mailto:peoter_veliki at hotmail.com]
    Sent: Friday, February 16, 2001 3:22 PM
    To: GB/DEV - Philip Nelson; jdom-interest at jdom.org
    Subject: Re: [jdom-interest] verify document with JDom?


    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/276f00d6/attachment.htm


More information about the jdom-interest mailing list