@Test public void testInvalidSemantics() throws Exception { ContentHandle content = resourceToContentHandle("xml-schema-invalid-semantics.xsd"); XsdContentValidator validator = new XsdContentValidator(); Assertions.assertThrows(InvalidContentException.class, () -> { validator.validate(ValidityLevel.FULL, content); }); }
@Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { super.validate(level, artifactContent); if (level == ValidityLevel.FULL) { try (InputStream semanticStream = artifactContent.stream()) { Source source = new StreamSource(semanticStream); SchemaFactoryAccessor.getSchemaFactory().newSchema(source); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XSD Schema artifact.", e); } } }
XsdContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { super.validate(level, artifactContent); if (level == ValidityLevel.FULL) { try (InputStream semanticStream = artifactContent.stream()) { Source source = new StreamSource(semanticStream); SchemaFactoryAccessor.getSchemaFactory().newSchema(source); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XSD Schema artifact.", e); } } } }
XsdContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { super.validate(level, artifactContent); if (level == ValidityLevel.FULL) { try (InputStream semanticStream = artifactContent.stream()) { Source source = new StreamSource(semanticStream); SchemaFactoryAccessor.getSchemaFactory().newSchema(source); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XSD Schema artifact.", e); } } } XsdContentValidator(); }
XsdContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { super.validate(level, artifactContent); if (level == ValidityLevel.FULL) { try (InputStream semanticStream = artifactContent.stream()) { Source source = new StreamSource(semanticStream); SchemaFactoryAccessor.getSchemaFactory().newSchema(source); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XSD Schema artifact.", e); } } } XsdContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent); }
XsdContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { super.validate(level, artifactContent); if (level == ValidityLevel.FULL) { try (InputStream semanticStream = artifactContent.stream()) { Source source = new StreamSource(semanticStream); SchemaFactoryAccessor.getSchemaFactory().newSchema(source); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XSD Schema artifact.", e); } } } XsdContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent);  }