Code example for SchemaFactory

Methods: newSchema

0
      return false; 
    } 
    Schema schema = schemas.get().get(schemaLocation);
    if (schema == null) {
      try { 
        schema = FACTORY.newSchema(schemaLocation);
        schemas.get().put(schemaLocation, schema);
      } 
      catch (SAXException exc) {
        LOGGER.info("Error parsing schema at {}", schemaPath, exc);
        return false; 
      } 
    } 
 
    // get a validator from the schema 
    Validator validator = schema.newValidator();
 
    // prepare the XML source 
    StringReader reader = new StringReader(xml);
    InputSource is = new InputSource(reader);
    SAXSource source = new SAXSource(is);