Package javax.xml.validation

Examples of javax.xml.validation.Schema


  }

  static Unmarshaller getUnMarsheller() throws JAXBException, SAXException {
    JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
    Unmarshaller un = jc.createUnmarshaller();
    un.setSchema(schema);
    return un;
  }
View Full Code Here


    roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2")); //$NON-NLS-1$ //$NON-NLS-2$
   
    vdb.addDataPolicy(roleOne);
   
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd"));      //$NON-NLS-1$
    JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
    Marshaller marshell = jc.createMarshaller();
    marshell.setSchema(schema);
    marshell.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
   
View Full Code Here

        LOG.fine("Created type schema for namespace " + namespaceURI);
    }

    public Validator getValidator() {
        if (null == validator) {
            Schema s = getSchema();
            validator = s.newValidator();
            validator.setErrorHandler(new TypeSchemaErrorHandler());
        }
        return validator;
    }
View Full Code Here

        return metadataSchema;
    }

    private Validator getMetadataValidator() {
        if (null == metadataValidator) {
            Schema schema = getMetadataSchema();
            // assert null != schema;
            metadataValidator = schema.newValidator();
            if (null == validatorErrorHandler) {
                validatorErrorHandler = new ValidatorErrorHandler();
            }
            metadataValidator.setErrorHandler(validatorErrorHandler);
            // assert null != metadataValidator;
View Full Code Here

    private Schema getSchema(InputStream is) {
        Source schemaFile = new StreamSource(is);

        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = null;
        try {
            schema = factory.newSchema(schemaFile);
        } catch (SAXException ex) {
            throw new ConfigurationException(new Message("SCHEMA_CREATION_ERROR_EXC", LOG), ex);
        }
View Full Code Here

        EndpointReferenceType ref =
            EndpointReferenceUtils.getEndpointReference(url, serviceName, portName);

        assertNotNull("Could not create endpoint reference", ref);

        Schema schema = EndpointReferenceUtils.getSchema(manager, ref);
        assertNotNull("Could not load schema from wsdl", schema);
    }
View Full Code Here

        synchronized (schemaMap) {
            if (schemaMap.containsKey(definition)) {
                return schemaMap.get(definition);
            }
        }
        Schema schema = schemaMap.get(definition);
        if (schema == null) {
            List<javax.wsdl.extensions.schema.Schema> schemas = getSchemas(definition);
            SchemaFactory factory = SchemaFactory.newInstance(
                XMLConstants.W3C_XML_SCHEMA_NS_URI);
            List<Source> schemaSources = new ArrayList<Source>();
View Full Code Here

                factory.setNamespaceAware(validate);
                if (validate)
                {
                    try
                    {
                        Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(
                            getRegisteredSchemas(mgr.getNucleusContext().getPluginManager()));
                        if (schema != null)
                        {
                            try
                            {
View Full Code Here

  @SuppressWarnings("boxing")
  @Test
  public void testValidate() throws Exception {
    PurchaseOrderType po = unmarshall();
    Schema s = loadSchema();
   
    Errors errors = ErrorsFactory.newInstance();

    Items.Item item1 = po.getItems().getItem().get(0);
   
View Full Code Here

  }

  private Schema loadSchema() {
    SchemaFactory sf = SchemaFactory
        .newInstance("http://www.w3.org/2001/XMLSchema"); //$NON-NLS-1$
    Schema s = null;
    try {
      s = sf.newSchema(getClass().getResource("/WEB-INF/schemas/po.xsd")); //$NON-NLS-1$
    } catch (SAXException e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of javax.xml.validation.Schema

Copyright © 2018 www.massapicom. 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.