[jdom-interest] trying to validate xml, part 2

Gregory S. Hill ghill at vmtllc.com
Thu Jan 13 13:08:36 PST 2005


By the way, this is the code I'm using to try to validate:

<snip>
         File file = new File("emais2-20050113.xml");

         try {
             SAXBuilder builder =
                 new SAXBuilder("org.apache.xerces.parsers.SAXParser", 
true);
             builder.setFeature(
                   "http://apache.org/xml/features/validation/schema", 
true);
             builder.setProperty(
 
"http://apache.org/xml/properties/schema/external-schemaLocation",
                   "http://134.192.110.131/emais/emais2_schema.xsd 
emais2_schema.xsd");

             Document doc = builder.build(file);
         } catch (IOException io) {
             io.printStackTrace();
         } catch (JDOMException je) {
             je.printStackTrace();
         }
</snip>

The files "emais2-20050113.xml" and "emais2_schema.xsd" both lie in the 
same directory as the above java program.

-greg


More information about the jdom-interest mailing list