本文整理了Java中org.geotools.xml.Parser.setStrict()
方法的一些代码示例,展示了Parser.setStrict()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.setStrict()
方法的具体详情如下:
包路径:org.geotools.xml.Parser
类名称:Parser
方法名:setStrict
[英]Sets the strict parsing flag.
When set to true
, this will cause the parser to operate in a strict mode, which means that xml being parsed must be exactly correct with respect to the schema it references.
Some examples of cases in which the parser will throw an exception while operating in strict mode:
true
时,这将导致解析器在严格模式下运行,这意味着解析的xml必须与它引用的模式完全正确。代码示例来源:origin: org.n52.wps/52n-wps-io-geotools
parser.setStrict(shouldSetParserStrict);
代码示例来源:origin: org.geoserver.csw/csw-core
@SuppressWarnings("unchecked")
public Object read(Object request, Reader reader, Map kvp) throws Exception {
Parser parser = new Parser(configuration);
parser.setValidating(true);
parser.setFailOnValidationError(true);
parser.setStrict(true);
Object parsed;
try {
parsed = parser.parse(reader);
} catch (Exception e) {
throw new ServiceException("Could not parse XML request.", e);
}
if (!parser.getValidationErrors().isEmpty()) {
ServiceException exception = new ServiceException("Invalid request",
"InvalidParameterValue");
for (Exception error : (List<Exception>) parser.getValidationErrors()) {
LOGGER.warning(error.getLocalizedMessage());
exception.getExceptionText().add(error.getLocalizedMessage());
}
}
return parsed;
}
}
代码示例来源:origin: org.geoserver.csw/gs-csw-core
@SuppressWarnings("unchecked")
public Object read(Object request, Reader reader, Map kvp) throws Exception {
Parser parser = new Parser(configuration);
parser.setValidating(true);
parser.setFailOnValidationError(true);
parser.setStrict(true);
parser.setEntityResolver(resolverProvider.getEntityResolver());
Object parsed;
try {
parsed = parser.parse(reader);
} catch (Exception e) {
throw new ServiceException("Could not parse XML request.", e);
}
if (!parser.getValidationErrors().isEmpty()) {
ServiceException exception =
new ServiceException("Invalid request", "InvalidParameterValue");
for (Exception error : (List<Exception>) parser.getValidationErrors()) {
LOGGER.warning(error.getLocalizedMessage());
exception.getExceptionText().add(error.getLocalizedMessage());
}
}
return parsed;
}
}
代码示例来源:origin: org.n52.wps/52n-wps-io-geotools
public GTVectorDataBinding parse(InputStream input, QName schematypeTuple) {
if(!setBasicGMLConfiguration){
if (configuration == null) {
configuration = resolveConfiguration(schematypeTuple);
}
}else{
configuration = new GMLConfiguration();
}
Parser parser = new Parser(configuration);
parser.setStrict(!setParserNonStrict);
//parse
FeatureCollection<?, SimpleFeature> fc = resolveFeatureCollection(parser, input);
GTVectorDataBinding data = new GTVectorDataBinding(fc);
return data;
}
代码示例来源:origin: org.geoserver/wcs1_1
public Object read(Object request, Reader reader, Map kvp) throws Exception {
//create the parser instance
Parser parser = new Parser(configuration);
parser.setValidating(true);
parser.setFailOnValidationError(true);
parser.setStrict(true);
// parse
Object parsed;
try {
parsed = parser.parse(reader);
} catch(Exception e) {
throw new WcsException("Parsing failed, the xml request is most probably not compliant to the wcs schema", e);
}
return parsed;
}
}
代码示例来源:origin: org.geoserver/gs-wcs1_1
public Object read(Object request, Reader reader, Map kvp) throws Exception {
// create the parser instance
Parser parser = new Parser(configuration);
parser.setValidating(true);
parser.setFailOnValidationError(true);
parser.setStrict(true);
parser.setEntityResolver(resolverProvider.getEntityResolver());
// parse
Object parsed;
try {
parsed = parser.parse(reader);
} catch (Exception e) {
throw new WcsException(
"Parsing failed, the xml request is most probably not compliant to the wcs schema",
e);
}
return parsed;
}
}
代码示例来源:origin: org.geoserver/gs-wcs1_0
public Object read(Object request, Reader reader, Map kvp) throws Exception {
// create the parser instance
Parser parser = new Parser(configuration);
parser.setValidating(true);
parser.setFailOnValidationError(true);
parser.setStrict(true);
parser.setEntityResolver(resolverProvider.getEntityResolver());
// parse
Object parsed;
try {
parsed = parser.parse(reader);
} catch (Exception e) {
throw new WcsException(
"Parsing failed, the xml request is most probably not compliant to the wcs schema",
e);
}
return parsed;
}
}
代码示例来源:origin: org.n52.wps/52n-wps-io-geotools
Object parsedData = null;
try {
parser.setStrict(shouldSetParserStrict);
parsedData = parser.parse(new FileInputStream(file));
} catch (SAXException e5) {
parser.setStrict(false);
parsedData = parser.parse(new FileInputStream(file));
代码示例来源:origin: org.n52.wps/52n-wps-io-geotools
parser.setStrict(shouldSetParserStrict);
代码示例来源:origin: org.geoserver/gs-wms
try {
Parser parser = new Parser(new WFSConfiguration());
parser.setStrict(false);
parser.setEntityResolver(resolverProvider.getEntityResolver());
Object result = parser.parse(is);
内容来源于网络,如有侵权,请联系作者删除!