You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Daniela Pistelli Gomes <da...@summa-tech.com> on 2004/04/02 22:41:39 UTC

Validator/Digester offline validation

Hi,

    I'm using commons-validator and commons-digester and I need to validate the validation.xml file
without internet access and I don't want to remove the doctye tag.
  I knew that I can implement any EntityResolver and set this at Digester, but I don't have any Digester
instance, my question is, how can I get any Digester instance (or if is possible set the EntityResolver 
by a Digest static method) and them set this Digest for Validator.

  At my Validator class I have

  private ValidatorResources initResources() throws IOException, SAXException {
      final InputStream rules = Thread.currentThread().getContextClassLoader()
                                    .getResourceAsStream("validator-rules.xml");
      final InputStream is = Thread.currentThread().getContextClassLoader()
                                       .getResourceAsStream("validation.xml");
      
      try {
         return new ValidatorResources(new InputStream[] {rules, is});
      } finally {
         if (rules != null) {
            rules.close();
         }

         if (is != null) {
            is.close();
         }
      }
   }

Thanks for your support

Best Regards
Daniela