热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.springframework.xml.validation.XmlValidator类的使用及代码示例

本文整理了Java中org.springframework.xml.validation.XmlValidator类的一些代码示例,展示了XmlValida

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

XmlValidator介绍

[英]Simple processor that validates a given Source. Can be created via the XmlValidatorFactory.

Instances of this class are designed to be thread safe.
[中]验证给定源的简单处理器。可以通过XmlValidatorFactory创建。
此类的实例被设计为线程安全的。

代码示例

代码示例来源:origin: spring-projects/spring-integration

@Override
public boolean accept(Message message) {
SAXParseException[] validatiOnExceptions= null;
try {
validatiOnExceptions= this.xmlValidator.validate(this.converter.convertToSource(message.getPayload()));
}
catch (Exception e) {
throw new MessageHandlingException(message, e);
}
boolean validatiOnSuccess= ObjectUtils.isEmpty(validationExceptions);
if (!validationSuccess) {
if (this.throwExceptionOnRejection) {
throw new MessageRejectedException(message, "Message was rejected due to XML Validation errors",
new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions)));
}
else if (this.logger.isInfoEnabled()) {
this.logger.info("Message was rejected due to XML Validation errors",
new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions)));
}
}
return validationSuccess;
}

代码示例来源:origin: net.javacrumbs/spring-ws-test

public void validate(WebServiceMessage message, XmlValidator validator) throws IOException{
Source requestSource = message.getPayloadSource();
if (requestSource != null) {
SAXParseException[] errors = validator.validate(requestSource);
if (!ObjectUtils.isEmpty(errors)) {
handleRequestValidationErrors(message, errors);
}
logger.debug("Request message validated");
}
else
{
logger.warn("Request source is null");
}
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public void match(WebServiceMessage message) throws IOException, AssertionError {
SAXParseException[] exceptiOns= xmlValidator.validate(message.getPayloadSource());
if (!ObjectUtils.isEmpty(exceptions)) {
fail("XML is not valid: " + Arrays.toString(exceptions), "Payload", message.getPayloadSource());
}
}
}

代码示例来源:origin: spring-projects/spring-ws

@Override
public void match(WebServiceMessage message) throws IOException, AssertionError {
SAXParseException[] exceptiOns= xmlValidator.validate(message.getPayloadSource());
if (!ObjectUtils.isEmpty(exceptions)) {
fail("XML is not valid: " + Arrays.toString(exceptions), "Payload", message.getPayloadSource());
}
}
}

代码示例来源:origin: org.springframework.ws/spring-ws-test

@Override
public void match(WebServiceMessage message) throws IOException, AssertionError {
SAXParseException[] exceptiOns= xmlValidator.validate(message.getPayloadSource());
if (!ObjectUtils.isEmpty(exceptions)) {
fail("XML is not valid: " + Arrays.toString(exceptions), "Payload", message.getPayloadSource());
}
}
}

代码示例来源:origin: org.springframework.ws/spring-ws-core

/**
* Validates the response message in the given message context. Validation only occurs if
* {@code validateResponse} is set to {@code true}, which is not the default.
*
*

Returns {@code true} if the request is valid, or {@code false} if it isn't.
*
* @param messageContext the message context.
* @return {@code true} if the response is valid; {@code false} otherwise
* @see #setValidateResponse(boolean)
*/
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws IOException, SAXException {
if (validateResponse) {
Source respOnseSource= getValidationResponseSource(messageContext.getResponse());
if (responseSource != null) {
SAXParseException[] errors = validator.validate(responseSource, errorHandler);
if (!ObjectUtils.isEmpty(errors)) {
return handleResponseValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Response message validated");
}
}
}
return true;
}

代码示例来源:origin: spring-projects/spring-ws

/**
* Validates the response message in the given message context. Validation only occurs if
* {@code validateResponse} is set to {@code true}, which is not the default.
*
*

Returns {@code true} if the request is valid, or {@code false} if it isn't.
*
* @param messageContext the message context.
* @return {@code true} if the response is valid; {@code false} otherwise
* @see #setValidateResponse(boolean)
*/
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws IOException, SAXException {
if (validateResponse) {
Source respOnseSource= getValidationResponseSource(messageContext.getResponse());
if (responseSource != null) {
SAXParseException[] errors = validator.validate(responseSource, errorHandler);
if (!ObjectUtils.isEmpty(errors)) {
return handleResponseValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Response message validated");
}
}
}
return true;
}

代码示例来源:origin: apache/servicemix-bundles

/**
* Validates the response message in the given message context. Validation only occurs if
* {@code validateResponse} is set to {@code true}, which is not the default.
*
*

Returns {@code true} if the request is valid, or {@code false} if it isn't.
*
* @param messageContext the message context.
* @return {@code true} if the response is valid; {@code false} otherwise
* @see #setValidateResponse(boolean)
*/
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws IOException, SAXException {
if (validateResponse) {
Source respOnseSource= getValidationResponseSource(messageContext.getResponse());
if (responseSource != null) {
SAXParseException[] errors = validator.validate(responseSource, errorHandler);
if (!ObjectUtils.isEmpty(errors)) {
return handleResponseValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Response message validated");
}
}
}
return true;
}

代码示例来源:origin: org.springframework.ws/org.springframework.ws

/**
* Validates the response message in the given message context. Validation only occurs if
* validateResponse is set to true, which is not the default.
*


* Returns true if the request is valid, or false if it isn't.
*
* @param messageContext the message context.
* @return true if the response is valid; false otherwise
* @see #setValidateResponse(boolean)
*/
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws IOException, SAXException {
if (validateResponse) {
Source respOnseSource= getValidationResponseSource(messageContext.getResponse());
if (responseSource != null) {
SAXParseException[] errors = validator.validate(responseSource);
if (!ObjectUtils.isEmpty(errors)) {
return handleResponseValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Response message validated");
}
}
}
return true;
}

代码示例来源:origin: spring-projects/spring-ws

/**
* Validates the request message in the given message context. Validation only occurs if
* {@code validateRequest} is set to {@code true}, which is the default.
*
*

Returns {@code true} if the request is valid, or {@code false} if it isn't. Additionally, when the
* request message is a {@link SoapMessage}, a {@link SoapFault} is added as response.
*
* @param messageContext the message context
* @return {@code true} if the message is valid; {@code false} otherwise
* @see #setValidateRequest(boolean)
*/
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint)
throws IOException, SAXException, TransformerException {
if (validateRequest) {
Source requestSource = getValidationRequestSource(messageContext.getRequest());
if (requestSource != null) {
SAXParseException[] errors = validator.validate(requestSource, errorHandler);
if (!ObjectUtils.isEmpty(errors)) {
return handleRequestValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Request message validated");
}
}
}
return true;
}

代码示例来源:origin: org.springframework.ws/spring-ws-core

/**
* Validates the request message in the given message context. Validation only occurs if
* {@code validateRequest} is set to {@code true}, which is the default.
*
*

Returns {@code true} if the request is valid, or {@code false} if it isn't. Additionally, when the
* request message is a {@link SoapMessage}, a {@link SoapFault} is added as response.
*
* @param messageContext the message context
* @return {@code true} if the message is valid; {@code false} otherwise
* @see #setValidateRequest(boolean)
*/
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint)
throws IOException, SAXException, TransformerException {
if (validateRequest) {
Source requestSource = getValidationRequestSource(messageContext.getRequest());
if (requestSource != null) {
SAXParseException[] errors = validator.validate(requestSource, errorHandler);
if (!ObjectUtils.isEmpty(errors)) {
return handleRequestValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Request message validated");
}
}
}
return true;
}

代码示例来源:origin: org.springframework.ws/org.springframework.ws

/**
* Validates the request message in the given message context. Validation only occurs if
* validateRequest is set to true, which is the default.
*


* Returns true if the request is valid, or false if it isn't. Additionally, when the
* request message is a {@link SoapMessage}, a {@link SoapFault} is added as response.
*
* @param messageContext the message context
* @return true if the message is valid; false otherwise
* @see #setValidateRequest(boolean)
*/
public boolean handleRequest(MessageContext messageContext, Object endpoint)
throws IOException, SAXException, TransformerException {
if (validateRequest) {
Source requestSource = getValidationRequestSource(messageContext.getRequest());
if (requestSource != null) {
SAXParseException[] errors = validator.validate(requestSource);
if (!ObjectUtils.isEmpty(errors)) {
return handleRequestValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Request message validated");
}
}
}
return true;
}

代码示例来源:origin: apache/servicemix-bundles

/**
* Validates the request message in the given message context. Validation only occurs if
* {@code validateRequest} is set to {@code true}, which is the default.
*
*

Returns {@code true} if the request is valid, or {@code false} if it isn't. Additionally, when the
* request message is a {@link SoapMessage}, a {@link SoapFault} is added as response.
*
* @param messageContext the message context
* @return {@code true} if the message is valid; {@code false} otherwise
* @see #setValidateRequest(boolean)
*/
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint)
throws IOException, SAXException, TransformerException {
if (validateRequest) {
Source requestSource = getValidationRequestSource(messageContext.getRequest());
if (requestSource != null) {
SAXParseException[] errors = validator.validate(requestSource, errorHandler);
if (!ObjectUtils.isEmpty(errors)) {
return handleRequestValidationErrors(messageContext, errors);
}
else if (logger.isDebugEnabled()) {
logger.debug("Request message validated");
}
}
}
return true;
}

代码示例来源:origin: org.springframework.ws/spring-ws-core

SAXParseException[] errors;
try {
errors = validator.validate(requestSource);

代码示例来源:origin: org.springframework.ws/org.springframework.ws

SAXParseException[] errors;
try {
errors = validator.validate(requestSource);

代码示例来源:origin: apache/servicemix-bundles

SAXParseException[] errors;
try {
errors = validator.validate(responseSource);

代码示例来源:origin: org.springframework.ws/spring-ws-core

SAXParseException[] errors;
try {
errors = validator.validate(responseSource);

代码示例来源:origin: spring-projects/spring-ws

SAXParseException[] errors;
try {
errors = validator.validate(requestSource);

代码示例来源:origin: org.springframework.ws/org.springframework.ws

SAXParseException[] errors;
try {
errors = validator.validate(responseSource);

代码示例来源:origin: apache/servicemix-bundles

SAXParseException[] errors;
try {
errors = validator.validate(requestSource);

推荐阅读
  • 网络请求模块选择——axios框架的基本使用和封装
    本文介绍了选择网络请求模块axios的原因,以及axios框架的基本使用和封装方法。包括发送并发请求的演示,全局配置的设置,创建axios实例的方法,拦截器的使用,以及如何封装和请求响应劫持等内容。 ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction ... [详细]
  • ASP.NET2.0数据教程之十四:使用FormView的模板
    本文介绍了在ASP.NET 2.0中使用FormView控件来实现自定义的显示外观,与GridView和DetailsView不同,FormView使用模板来呈现,可以实现不规则的外观呈现。同时还介绍了TemplateField的用法和FormView与DetailsView的区别。 ... [详细]
  • 本文介绍了Python爬虫技术基础篇面向对象高级编程(中)中的多重继承概念。通过继承,子类可以扩展父类的功能。文章以动物类层次的设计为例,讨论了按照不同分类方式设计类层次的复杂性和多重继承的优势。最后给出了哺乳动物和鸟类的设计示例,以及能跑、能飞、宠物类和非宠物类的增加对类数量的影响。 ... [详细]
  • Imtryingtofigureoutawaytogeneratetorrentfilesfromabucket,usingtheAWSSDKforGo.我正 ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • YOLOv7基于自己的数据集从零构建模型完整训练、推理计算超详细教程
    本文介绍了关于人工智能、神经网络和深度学习的知识点,并提供了YOLOv7基于自己的数据集从零构建模型完整训练、推理计算的详细教程。文章还提到了郑州最低生活保障的话题。对于从事目标检测任务的人来说,YOLO是一个熟悉的模型。文章还提到了yolov4和yolov6的相关内容,以及选择模型的优化思路。 ... [详细]
  • 本文介绍了使用postman进行接口测试的方法,以测试用户管理模块为例。首先需要下载并安装postman,然后创建基本的请求并填写用户名密码进行登录测试。接下来可以进行用户查询和新增的测试。在新增时,可以进行异常测试,包括用户名超长和输入特殊字符的情况。通过测试发现后台没有对参数长度和特殊字符进行检查和过滤。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • Android JSON基础,音视频开发进阶指南目录
    Array里面的对象数据是有序的,json字符串最外层是方括号的,方括号:[]解析jsonArray代码try{json字符串最外层是 ... [详细]
  • 本文探讨了C语言中指针的应用与价值,指针在C语言中具有灵活性和可变性,通过指针可以操作系统内存和控制外部I/O端口。文章介绍了指针变量和指针的指向变量的含义和用法,以及判断变量数据类型和指向变量或成员变量的类型的方法。还讨论了指针访问数组元素和下标法数组元素的等价关系,以及指针作为函数参数可以改变主调函数变量的值的特点。此外,文章还提到了指针在动态存储分配、链表创建和相关操作中的应用,以及类成员指针与外部变量的区分方法。通过本文的阐述,读者可以更好地理解和应用C语言中的指针。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 标题: ... [详细]
  • 本文介绍了如何使用Express App提供静态文件,同时提到了一些不需要使用的文件,如package.json和/.ssh/known_hosts,并解释了为什么app.get('*')无法捕获所有请求以及为什么app.use(express.static(__dirname))可能会提供不需要的文件。 ... [详细]
author-avatar
mobiledu2502885977
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有