uk.co.real_logic.sbe.xml.XmlSchemaParser.validate()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(62)

本文整理了Java中uk.co.real_logic.sbe.xml.XmlSchemaParser.validate()方法的一些代码示例,展示了XmlSchemaParser.validate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlSchemaParser.validate()方法的具体详情如下:
包路径:uk.co.real_logic.sbe.xml.XmlSchemaParser
类名称:XmlSchemaParser
方法名:validate

XmlSchemaParser.validate介绍

[英]Validate the document against a given schema. Error will be written to java.lang.System#err
[中]根据给定的架构验证文档。错误将被写入java。lang.System#err

代码示例

代码示例来源:origin: real-logic/simple-binary-encoding

/**
 * Validate the SBE Schema against the XSD.
 *
 * @param sbeSchemaFilename to be validated
 * @param xsdFilename       XSD against which to validate
 * @throws Exception if an error occurs while validating
 */
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
  throws Exception
{
  final ParserOptions.Builder optionsBuilder = ParserOptions.builder()
    .xsdFilename(System.getProperty(VALIDATION_XSD))
    .xIncludeAware(Boolean.parseBoolean(System.getProperty(XINCLUDE_AWARE)))
    .stopOnError(Boolean.parseBoolean(System.getProperty(VALIDATION_STOP_ON_ERROR)))
    .warningsFatal(Boolean.parseBoolean(System.getProperty(VALIDATION_WARNINGS_FATAL)))
    .suppressOutput(Boolean.parseBoolean(System.getProperty(VALIDATION_SUPPRESS_OUTPUT)));
  try (InputStream in = new BufferedInputStream(Files.newInputStream(Paths.get(sbeSchemaFilename))))
  {
    XmlSchemaParser.validate(xsdFilename, in, optionsBuilder.build());
  }
}

代码示例来源:origin: uk.co.real-logic/sbe

/**
 * Validate the SBE Schema against the XSD.
 *
 * @param sbeSchemaFilename to be validated
 * @param xsdFilename       XSD against which to validate
 * @throws Exception if an error occurs while validating
 */
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
  throws Exception
{
  try (final BufferedInputStream in = new BufferedInputStream(new FileInputStream(sbeSchemaFilename)))
  {
    XmlSchemaParser.validate(xsdFilename, in);
  }
}

代码示例来源:origin: uk.co.real-logic/sbe-tool

/**
 * Validate the SBE Schema against the XSD.
 *
 * @param sbeSchemaFilename to be validated
 * @param xsdFilename       XSD against which to validate
 * @throws Exception if an error occurs while validating
 */
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
  throws Exception
{
  final ParserOptions.Builder optionsBuilder = ParserOptions.builder()
    .xsdFilename(System.getProperty(VALIDATION_XSD))
    .xIncludeAware(Boolean.parseBoolean(System.getProperty(XINCLUDE_AWARE)))
    .stopOnError(Boolean.parseBoolean(System.getProperty(VALIDATION_STOP_ON_ERROR)))
    .warningsFatal(Boolean.parseBoolean(System.getProperty(VALIDATION_WARNINGS_FATAL)))
    .suppressOutput(Boolean.parseBoolean(System.getProperty(VALIDATION_SUPPRESS_OUTPUT)));
  try (InputStream in = new BufferedInputStream(Files.newInputStream(Paths.get(sbeSchemaFilename))))
  {
    XmlSchemaParser.validate(xsdFilename, in, optionsBuilder.build());
  }
}

代码示例来源:origin: uk.co.real-logic/sbe-all

/**
 * Validate the SBE Schema against the XSD.
 *
 * @param sbeSchemaFilename to be validated
 * @param xsdFilename       XSD against which to validate
 * @throws Exception if an error occurs while validating
 */
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
  throws Exception
{
  final ParserOptions.Builder optionsBuilder = ParserOptions.builder()
    .xsdFilename(System.getProperty(VALIDATION_XSD))
    .xIncludeAware(Boolean.parseBoolean(System.getProperty(XINCLUDE_AWARE)))
    .stopOnError(Boolean.parseBoolean(System.getProperty(VALIDATION_STOP_ON_ERROR)))
    .warningsFatal(Boolean.parseBoolean(System.getProperty(VALIDATION_WARNINGS_FATAL)))
    .suppressOutput(Boolean.parseBoolean(System.getProperty(VALIDATION_SUPPRESS_OUTPUT)));
  try (InputStream in = new BufferedInputStream(Files.newInputStream(Paths.get(sbeSchemaFilename))))
  {
    XmlSchemaParser.validate(xsdFilename, in, optionsBuilder.build());
  }
}

相关文章