Examples of SchemaFactory


Examples of javax.xml.validation.SchemaFactory

        return clone;
    }

   
    public void validateSchema(Element ele) throws ToolException {
        SchemaFactory schemaFact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        DOMSource domSrc = new DOMSource(ele);
        try {
            schemaFact.newSchema(domSrc);
        } catch (SAXException e) {
            if (e.getLocalizedMessage().indexOf("src-resolve.4.2") > -1)  {
                //Ignore schema resolve error and do nothing
            } else {
                throw new ToolException("Schema Error : " + e.getLocalizedMessage(), e);
View Full Code Here

Examples of javax.xml.validation.SchemaFactory

            } catch (final Exception ex) {
                LOGGER.error("Unable to access schema " + schema);
            }
            if (is != null) {
                final Source src = new StreamSource(is, LOG4J_XSD);
                final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                Schema schema = null;
                try {
                    schema = factory.newSchema(src);
                } catch (final SAXException ex) {
                    LOGGER.error("Error parsing Log4j schema", ex);
                }
                if (schema != null) {
                    validator = schema.newValidator();
View Full Code Here

Examples of org.apache.ambari.server.controller.spi.SchemaFactory

* MinimalRenderer unit tests.
*/
public class MinimalRendererTest {
  @Test
  public void testFinalizeProperties__instance_noProperties() {
    SchemaFactory schemaFactory = createNiceMock(SchemaFactory.class);
    Schema schema = createNiceMock(Schema.class);

    // schema expectations
    expect(schemaFactory.getSchema(Resource.Type.Component)).andReturn(schema).anyTimes();
    expect(schema.getKeyPropertyId(Resource.Type.Component)).andReturn("ServiceComponentInfo/component_name").anyTimes();

    replay(schemaFactory, schema);

    QueryInfo rootQuery = new QueryInfo(new ServiceResourceDefinition(), new HashSet<String>());
View Full Code Here

Examples of org.apache.cocoon.components.validation.SchemaFactory

            Source schemaSrc = getSourceResolver().resolveURI(schDoc);

            try {
                InputSource is = SourceUtil.getInputSource(schemaSrc);
                SchemaFactory schf = SchemaFactory.lookup(schNS);
                Schema sch = schf.compileSchema(is);

                return sch.newValidator();
            } finally {
                getSourceResolver().release(schemaSrc);
            }
View Full Code Here

Examples of org.apache.cocoon.validation.SchemaFactory

      // use custom schema
      File file = new File( args[0] );
      if ( !file.exists () ) throw new Exception("Error: schema file not found !");
     InputStream istrm = new FileInputStream ( file );
     InputSource is = new InputSource ( istrm );
     SchemaFactory schf = SchemaFactory.lookup( SchemaFactory.NAMESPACE_SCHEMATRON );
     Schema sch = schf.compileSchema( is );
     Validator validator = sch.newValidator();

     // set preprocessor parameters
      if (args.length > 1)
         validator.setProperty("phase", new String(args[1]));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.