Package org.springframework.xml.xsd

Examples of org.springframework.xml.xsd.XsdSchema


    }

    @Test
    public void testXmime() throws Exception {
        Resource resource = new ClassPathResource("xmime.xsd", AbstractXsdSchemaTestCase.class);
        XsdSchema schema = createSchema(resource);
        String namespace = "urn:test";
        assertEquals("Invalid target namespace", namespace, schema.getTargetNamespace());
        Document result = (Document) ((DOMSource) schema.getSource()).getNode();
        Element schemaElement = result.getDocumentElement();
        Element elementElement = (Element) schemaElement.getFirstChild();
        assertNotNull("No expectedContentTypes found",
                elementElement.getAttributeNS("http://www.w3.org/2005/05/xmlmime", "expectedContentTypes"));
    }
View Full Code Here


        WsdlDefinition definition = getWsdlDefinition(httpServletRequest);
        if (definition != null) {
            wsdlDefinitionHandlerAdapter.handle(httpServletRequest, httpServletResponse, definition);
            return;
        }
        XsdSchema schema = getXsdSchema(httpServletRequest);
        if (schema != null) {
            xsdSchemaHandlerAdapter.handle(httpServletRequest, httpServletResponse, schema);
            return;
        }
        messageReceiverHandlerAdapter.handle(httpServletRequest, httpServletResponse, messageReceiver);
View Full Code Here

    protected long getLastModified(HttpServletRequest httpServletRequest) {
        WsdlDefinition definition = getWsdlDefinition(httpServletRequest);
        if (definition != null) {
            return wsdlDefinitionHandlerAdapter.getLastModified(httpServletRequest, definition);
        }
        XsdSchema schema = getXsdSchema(httpServletRequest);
        if (schema != null) {
            return xsdSchemaHandlerAdapter.getLastModified(httpServletRequest, schema);
        }
        return messageReceiverHandlerAdapter.getLastModified(httpServletRequest, messageReceiver);
    }
View Full Code Here

        xsdSchemas = BeanFactoryUtils
                .beansOfTypeIncludingAncestors(context, XsdSchema.class, true, false);
        if (logger.isDebugEnabled()) {
            for (Map.Entry<String, XsdSchema> entry : xsdSchemas.entrySet()) {
                String beanName = entry.getKey();
                XsdSchema schema = entry.getValue();
                logger.debug("Published [" + schema + "] as " + beanName + XSD_SUFFIX_NAME);
            }
        }
    }
View Full Code Here

    @Override
    public void afterPropertiesSet() throws Exception {
        if (!StringUtils.hasText(delegate.getTargetNamespace()) && typesProvider.getSchemaCollection() != null &&
                typesProvider.getSchemaCollection().getXsdSchemas().length > 0) {
            XsdSchema schema = typesProvider.getSchemaCollection().getXsdSchemas()[0];
            setTargetNamespace(schema.getTargetNamespace());
        }
        if (!StringUtils.hasText(serviceName) && StringUtils.hasText(portTypesProvider.getPortTypeName())) {
            soapProvider.setServiceName(portTypesProvider.getPortTypeName() + "Service");
        }
        delegate.afterPropertiesSet();
View Full Code Here

     * @return boolean flag marking matching schema instance found
     * @throws IOException
     * @throws SAXException
     */
    public boolean canValidate(Document doc) throws IOException, SAXException {
        XsdSchema schema = schemaMappingStrategy.getSchema(schemas, doc);
        return schema != null;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public XsdSchema getSchema(List<XsdSchema> schemas, Document doc) {
        XsdSchema schema = null;
       
        for (XsdSchemaMappingStrategy strategy : strategies) {
            schema = strategy.getSchema(schemas, doc);
           
            if (schema != null) {
View Full Code Here

    /** Root element names mapping to schema instances */
    private Map<String, XsdSchema> mappings;
   
    @Override
    public XsdSchema getSchema(List<XsdSchema> schemas, String namespace, String elementName) {
        XsdSchema schema = null;
        QName rootQName = QNameUtils.createQName(namespace, elementName, "");
       
        if (mappings.containsKey(rootQName.toString())) {
            schema = mappings.get(rootQName.toString());
        } else if (mappings.containsKey(elementName)) {
            schema = mappings.get(elementName);
        }
       
        if (schema!= null && !(StringUtils.hasText(schema.getTargetNamespace()) &&
                schema.getTargetNamespace().equals(namespace))) {
            throw new CitrusRuntimeException("Schema target namespace inconsitency " +
                "for located XSD schema definition (" + schema.getTargetNamespace() + ")");
        }
       
        return schema;
    }
View Full Code Here

TOP

Related Classes of org.springframework.xml.xsd.XsdSchema

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.