@Test public void testValidSyntax() throws Exception { ContentHandle content = resourceToContentHandle("xml-valid.xml"); XsdContentValidator validator = new XsdContentValidator(); validator.validate(ValidityLevel.SYNTAX_ONLY, content); }
@Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { DocumentBuilderAccessor.getDocumentBuilder().parse(stream); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XML Schema artifact.", e); } } }
XmlContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { DocumentBuilderAccessor.getDocumentBuilder().parse(stream); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XML Schema artifact.", e); } } } }
XmlContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { DocumentBuilderAccessor.getDocumentBuilder().parse(stream); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XML Schema artifact.", e); } } } XmlContentValidator(); }
XmlContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { DocumentBuilderAccessor.getDocumentBuilder().parse(stream); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XML Schema artifact.", e); } } } XmlContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent); }
XmlContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { DocumentBuilderAccessor.getDocumentBuilder().parse(stream); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XML Schema artifact.", e); } } } XmlContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent);  }