Package javax.xml.validation

Examples of javax.xml.validation.SchemaFactory.newSchema()


                        schemaSource = new StreamSource(schemaResource.getInputStream());
                    } else {
                        schemaSource = new StreamSource(schemaResource.getInputStream(), schemaResource.getURL().toExternalForm());
                    }
                }
                schema = factory.newSchema(schemaSource);
            }
        }
        catch (IOException e) {
            throw new JBIException("Failed to load schema: " + e, e);
        }
View Full Code Here


        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        try {
            // XML schema for validation
            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA);
            Schema schema = sf.newSchema(xsdUrl);
            Validator validator = schema.newValidator();

            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(new InputSource(in));
            validator.validate(new DOMSource(doc));
View Full Code Here

            // Allow privileged access to check files. Requires FilePermission
            // in security policy.
            try {
                aggregatedSchema = AccessController.doPrivileged(new PrivilegedExceptionAction<Schema>() {
                    public Schema run() throws SAXException {
                        return schemaFactory.newSchema(sources.toArray(new Source[sources.size()]));
                    }
                });
            } catch (PrivilegedActionException e) {
              warn(monitor, "PrivilegedActionException", schemaFactory, (SAXException)e.getException());
              hasSchemas = false;
View Full Code Here

                sources[i] = new StreamSource(connection.getInputStream(), uri);
            }
           
            // Create an aggregated validation schemas from all the XSDs
            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            aggregatedSchema= schemaFactory.newSchema(sources);
           
        } catch (Error e) {
            //FIXME Log this, some old JDKs don't support XMLSchema validation
            //e.printStackTrace();
        } catch (SAXParseException e) {
View Full Code Here

            return;
        } catch (Exception e) {
            // Some old JDKs don't support XMLSchema validation
            return;
        }
        Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
        ValidatorHandler handler = schema.newValidatorHandler();
       
        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
        URL url = getClass().getResource("Calculator.composite");
        XMLReader reader = parserFactory.newSAXParser().getXMLReader();
View Full Code Here

            return;
        } catch (Exception e) {
            // Some old JDKs don't support XMLSchema validation
            return;
        }
        Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
        ValidatorHandler handler = schema.newValidatorHandler();
       
        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
        URL url = getClass().getResource("JavaScriptReference.composite");
        XMLReader reader = parserFactory.newSAXParser().getXMLReader();
View Full Code Here

            return;
        } catch (Exception e) {
            // Some old JDKs don't support XMLSchema validation
            return;
        }
        Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
        ValidatorHandler handler = schema.newValidatorHandler();
       
        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
        URL url = getClass().getResource("RMIBindingTest.composite");
        XMLReader reader = parserFactory.newSAXParser().getXMLReader();
View Full Code Here

    protected Schema createSchema() throws SAXException, IOException {
        SchemaFactory factory = getSchemaFactory();

        URL url = getSchemaUrl();
        if (url != null) {
            return factory.newSchema(url);
        }
        File file = getSchemaFile();
        if (file != null) {
            return factory.newSchema(file);
        }
View Full Code Here

        if (url != null) {
            return factory.newSchema(url);
        }
        File file = getSchemaFile();
        if (file != null) {
            return factory.newSchema(file);
        }
        return factory.newSchema(getSchemaSource());
    }

    /**
 
View Full Code Here

        }
        File file = getSchemaFile();
        if (file != null) {
            return factory.newSchema(file);
        }
        return factory.newSchema(getSchemaSource());
    }

    /**
     * Checks whether we need an {@link InputStream} to access the message body.
     * <p/>
 
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.