- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.n52.oxf.xmlbeans.parser.XMLBeansParser
类的一些代码示例,展示了XMLBeansParser
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLBeansParser
类的具体详情如下:
包路径:org.n52.oxf.xmlbeans.parser.XMLBeansParser
类名称:XMLBeansParser
[英]Use this class when validating XML contents. Several static methods are provided to parse XML from String or InputStream.
[中]验证XML内容时使用此类。提供了几种静态方法来解析字符串或InputStream中的XML。
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
/**
* Reads the given source. The source may be only the xml-document or
* contain an application/x-www-form-url encoded string. In this case, the
* request must have the form <em>request=</em>
*
* @param xmlnode The xml source.
* @return The parsed xbeans XmlObject
* @throws XMLHandlingException thrown if the XML is incorrect
*/
public static XmlObject parse(final Node xmlnode) throws XMLHandlingException {
return parse(xmlnode, true);
}
代码示例来源:origin: org.n52.sensorweb/oxf-sos-adapter
private void doLaxRequestValidation(final XmlObject xbRequest) throws OXFException {
XMLBeansParser.registerLaxValidationCase(SFSpatialSamplingFeatureCase.getInstance());
XMLBeansParser.registerLaxValidationCase(SosInsertionMetadataCase.getInstance());
XMLBeansParser.registerLaxValidationCase(InsertionMetadataMissingCase.getInstance());
final Collection<XmlError> validate = XMLBeansParser.validate(xbRequest);
for (final XmlError xmlError : validate) {
// do some checking to provide better error messages
// TODO implement useful error handling
throw new OXFException(xmlError.getMessage());
}
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
/**
* private helper method for throwing an exception if validation
* was used within a parsing request.
*/
private static void validateOnParse(final XmlObject doc) throws XMLHandlingException {
if (!validationGlobally) {
return;
}
final String errorString = createErrorMessage(validate(doc));
if (errorString.length() > 0) {
throw new XMLHandlingException(errorString);
}
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
public static boolean validateXml(XmlObject xml) throws XMLHandlingException {
Collection<XmlError> errors = XMLBeansParser.validate(xml);
if ( !errors.isEmpty()) {
StringBuilder sb = new StringBuilder("Invalid request/response:");
for (XmlError xmlError : errors) {
sb.append("\n[xmlError] ").append(xmlError.toString());
}
throw new XMLHandlingException(sb.toString());
}
return true;
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
/**
* @param resourceAsStream The source as a stream.
* @param validate Validate the source?
* @return The parsed xbeans XmlObject
* @throws XMLHandlingException thrown if the XML is incorrect
*/
public static XmlObject parse(final InputStream resourceAsStream, final boolean validate) throws XMLHandlingException {
XmlObject doc;
try {
doc = XmlObject.Factory.parse(resourceAsStream);
} catch (final XmlException e) {
/* cannot parse xml string. Maybe a stream problem? try to read as String!
* This has been implemented because of XmlBeans stream issues. */
doc = parseAsStringDueToXmlBeansStreamIssues(resourceAsStream, e);
} catch (final IOException e) {
throw new XMLHandlingException("Cannot read the document: Transmission interrupted!", e);
}
if (validate) {
validateOnParse(doc);
}
return doc;
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
/**
* Validates an xml doc. If the validation fails, the exception contains a
* detailed list of errors.
*
* @param doc the document to validate
* @return a Collection of XmlErros. List is empty, if no error is found.
*/
public static Collection<XmlError> validate(final XmlObject doc) {
final Set<XmlError> validationErrors = new HashSet<>();
if (!validationGlobally) {
return validationErrors;
}
// Create an XmlOptions instance and set the error listener.
final List<XmlError> allValidationErrors = new ArrayList<>();
final XmlOptions validationOptions = new XmlOptions();
validationOptions.setErrorListener(allValidationErrors);
// Validate the XML document
final boolean isValid = doc.validate(validationOptions);
// Create Exception with error message if the xml document is invalid
if (!isValid) {
/*
* check if we have special validation cases which could
* let the message pass anyhow
*/
filterValidationErrors(validationErrors, allValidationErrors);
}
return validationErrors;
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-swes-v20
/**
* @param request the request to validate
* @throws InvalidRequestException if request is invalid. Contains validation errors as locator.
*/
public static void validateSwesRequest(XmlObject request) throws InvalidRequestException {
Collection<XmlError> validationErrors = XMLBeansParser.validate(request);
if (!validationErrors.isEmpty()) {
String locator = createValidationMessageLocator(validationErrors);
throw new InvalidRequestException(locator);
}
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
/**
* Reads the given source. The source may be only the xml-document or
* contain an application/x-www-form-url encoded string. In this case, the
* request must have the form <em>request=</em>
*
* @param source The xml source.
* @return The parsed xbeans XmlObject
* @throws XMLHandlingException thrown if the XML is incorrect
*/
public static XmlObject parse(final String source) throws XMLHandlingException {
return parse(source, true);
}
代码示例来源:origin: org.n52.sensorweb/oxf-sos-adapter
XMLBeansParser.registerLaxValidationCase(GMLAbstractFeatureCase.getInstance());
XMLBeansParser.registerLaxValidationCase(SASamplingPointCase.getInstance());
XMLBeansParser.registerLaxValidationCase(OfferingInSMLOutputsCase.getInstance());
final Collection<XmlError> exs = XMLBeansParser.validate(xmlDoc);
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
private boolean validateSubstitutionGroup(final XmlValidationError xve)
{
try {
final SFSpatialSamplingFeatureType featureDocument = SFSpatialSamplingFeatureType.Factory.parse(xve.getObjectLocation().xmlText());
final Collection<XmlError> revalidation = XMLBeansParser.validate(featureDocument);
return revalidation.size()==0?true:false;
} catch (final XmlException e) {}
return false;
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
/**
* @param resourceAsStream the xml source as stream
* @return The parsed xbeans XmlObject
* @throws XMLHandlingException thrown if the XML is incorrect
*/
public static XmlObject parse(final InputStream resourceAsStream) throws XMLHandlingException {
return parse(resourceAsStream, true);
}
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
XMLBeansParser.registerLaxValidationCase(GMLAbstractFeatureCase.getInstance());
final Collection<XmlError> exs = XMLBeansParser.validate(xb_doc);
代码示例来源:origin: org.n52.sensorweb/52n-oxf-xmlbeans
private boolean validateSubstitutionGroup(final XmlValidationError xve)
{
try {
final SosInsertionMetadataType sosInsertionMetadataType = SosInsertionMetadataType.Factory.parse(xve.getObjectLocation().xmlText());
final Collection<XmlError> revalidation = XMLBeansParser.validate(sosInsertionMetadataType);
return revalidation.size()==0?true:false;
} catch (final XmlException e) {}
return false;
}
代码示例来源:origin: org.n52.sensorweb/oxf-sos-adapter
/**
* @deprecated use instead {@link #SOSObservationStore(OperationResult)} and {@link #unmarshalFeatures()}
*/
@Deprecated
protected OXFFeatureCollection unmarshalFeatures100(OperationResult operationResult) throws OXFException {
try {
this.xmlObject = XMLBeansParser.parse(operationResult.getIncomingResultAsAutoCloseStream());
return unmarshalFeatures(operationResult);
} catch (XMLHandlingException e) {
throw new OXFException("Could not parse OperationResult.", e);
}
}
代码示例来源:origin: org.n52.sensorweb/oxf-adapter-api
protected OperationResultStore(OperationResult operationResult) throws OXFException {
try {
this.xmlObject = XMLBeansParser.parse(operationResult.getIncomingResultAsAutoCloseStream(), false);
this.version = getVersion(operationResult);
}
catch (XMLHandlingException e) {
throw new OXFException("Could not parse OperationResult.", e);
}
}
代码示例来源:origin: org.n52.sensorweb/oxf-sos-adapter
/**
* @deprecated Use {@link SOSSensorStore#SOSSensorStore(OperationResult)} with {@link SOSSensorStore#unmarshalFeatures(OperationResult)}
*/
public OXFFeatureCollection unmarshalFeatures(OperationResult operationResult) throws OXFException {
try {
this.xmlObject = XMLBeansParser.parse(operationResult.getIncomingResultAsAutoCloseStream());
this.version = getVersion(operationResult);
} catch (XMLHandlingException e) {
throw new OXFException("Could not parse OperationResult", e);
}
return unmarshalFeatures();
}
代码示例来源:origin: org.n52.epos/epos-transform-om
xobj = XMLBeansParser.parse(anyTypeDoc.toString(), false);
代码示例来源:origin: org.n52.sensorweb/sensorwebclient-api
smlDoc = SensorMLDocument.Factory.newInstance();
Member member = smlDoc.addNewSensorML().addNewMember();
member.set(XMLBeansParser.parse(object.newInputStream()));
} else {
smlDoc = SensorMLDocument.Factory.parse(dataDescription.newInputStream());
我想解析一些文本,其中某些字段在大多数情况下都具有结构,但偶尔(由于特殊大小写、拼写错误等)该结构会丢失。 例如常规情况是 Cost: 5,但偶尔会显示 Cost: 5m 或 Cost: 3 + 1
以下有什么区别: parser.setFeature("http://xml.org/sax/features/validation",true); and parser.setFeature("ht
我尝试在 Windows 8.1 上的 Git Bash 客户端中执行 npm install,但收到以下错误: npm WARN optional SKIPPING OPTIONAL DEPENDE
试图理解 evancz/url-parser 模块时,我偶然发现了这种我难以理解的类型声明:( source ) type Parser a b = Parser (State a -> List
我长期使用下面的 TypeScript 和 Vue 预设。它有效,但我还没有理解每个选项,现在要理解它。第一:parser之间有什么区别?和 @typescript-eslint/parser ? p
我正在尝试使用node-sql-parser在nodejs中解析sql查询。 const {Parser} = require('node-sql-parser'); const parser = n
自定义指令中的 ngModelCtrl.$parsers.unshift 和 ngModelCtrl.$parsers.push 之间的确切区别是什么。 当发生对模型生效但对表单本身无效的事情时,我想
我正在寻找 SAX 和 Pull Parser 之间的主要区别。我知道 SAX 解析器非常适合处理大型 XML 文件,因为它不存储 XML 并且只在一个方向上遍历。与 DOM 相比。但我无法找到 SA
我已经按照存档中的说明成功(?)安装了 QJson 库。但是编译器给我这个错误: Undefined reference to QJSon::Parser::Parser(). 我找到了安装库文件的位
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
尝试实现 Cucumber 来进行一些自动化测试。当我使用 junit 运行测试时,出现以下错误 项目路径: src/test/java/ cucumberJava -cucumberjava,ja
我已经阅读了我能找到的所有文档,但是我找不到关于这两个中间件的作用的简单解释。 body-parser 中的body 指的是什么?为什么需要解析正文? Cookie 也类似。我是否更正了 cookie
我在gradle项目中使用Xerces jar,然后在gradle插件中使用该项目的jar:实际上,我正在开发一个gradle插件,其中包含使用gradle项目jar的某些功能的自定义任务;当我尝试运
我正在尝试连接到 Linux 上的 FTP 服务器,当我执行 ftp.listFiles(remote); 时遇到异常 SYST 215 Linux Exception in thread "AW
我有react-app的示例安装,我得到了以下内容 Error: Failed to load parser '@typescript-eslint/parser' declared in '.esl
我在 there 中提到过类似的问题.我正在使用 mvn clean compile site 命令,我的版本是: cobertura.version: 2.5.1 findbugs.version:
我正在 Eclipse 中开发 GWT 应用程序并使用 jdom2 读取一些自定义 xml 属性文件。 在最近的更新之后,我的应用程序现在在尝试读取 xml 文件时失败并出现上述错误。相关堆栈跟踪是:
我正在使用 spring+maven。我正在 tomcat 服务器中部署我的应用程序。当我尝试运行我的应用程序时,突然出现以下错误。 INFO: Starting Servlet Engine: Ap
我在玩dateutil module在 Python 2.7.3 中。我只是想使用: import dateutil dateutil.parser.parse("01-02-2013") 但我得到了
一.入参解析库 argparse 有时候写Python脚本,需要处理入参[-h][-v][-F]...等情况,如果自己来解析的话,会花费很多时间,而且也容易出问题,好在Python有现成的li
我是一名优秀的程序员,十分优秀!