org.geotools.xml.Parser.setEntityResolver()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(114)

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

Parser.setEntityResolver介绍

暂无

代码示例

代码示例来源:origin: geosdi/geo-platform

private StyledLayerDescriptor parse11(Object input, ResourceLocator resourceLocator, EntityResolver entityResolver)
    throws IOException {
  Parser parser = createSld11Parser(input, resourceLocator, entityResolver);
  try {
    parser.setEntityResolver(entityResolver);
    return (StyledLayerDescriptor) parser.parse(toReader(input));
  } catch (Exception e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: org.geoserver.extension/gs-wps-core

/**
 * Returns a parser using the given configuration
 *
 * @param configuration
 */
protected Parser getParser(Configuration configuration) {
  Parser parser = new Parser(configuration);
  // spring injection would have been preferred, but it changes the order in which PPIO
  // are listed, which in turn chances the behavior of WPS (e.g., default mimeType)
  parser.setEntityResolver(getResolveProvider().getEntityResolver());
  return parser;
}

代码示例来源:origin: org.geoserver/gs-wfs

parser.setEntityResolver(entityResolverProvider.getEntityResolver());

代码示例来源:origin: org.geoserver/gs-wms

parser_1_0_0.setEntityResolver(resolverProvider.getEntityResolver());
  filter = (Filter) parser_1_0_0.parse(input);
} catch (Exception e) {
        new org.geotools.filter.v1_1.OGCConfiguration();
    Parser parser_1_1_0 = new Parser(configuration);
    parser_1_1_0.setEntityResolver(resolverProvider.getEntityResolver());
    filter = (Filter) parser_1_1_0.parse(input);

代码示例来源:origin: org.geoserver.extension/gs-wps-core

@SuppressWarnings("unchecked")
  public Object read(Object request, Reader reader, Map kvp) throws Exception {
    Parser parser = new Parser(configuration);
    parser.setValidating(true);
    parser.setEntityResolver(resolverProvider.getEntityResolver());

    Object parsed;
    try {
      parsed = parser.parse(reader);
    } catch (Exception e) {
      throw new WPSException("Could not parse XML request.", e);
    }

    if (!parser.getValidationErrors().isEmpty()) {
      WPSException exception = new WPSException("Invalid request", "InvalidParameterValue");

      for (Exception error : (List<Exception>) parser.getValidationErrors()) {
        LOGGER.warning(error.getLocalizedMessage());
        exception.getExceptionText().add(error.getLocalizedMessage());
      }
    }

    return parsed;
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

public Object read(Object request, Reader reader, Map kvp) throws Exception {
    // TODO: make this configurable?
    configuration.getProperties().add(Parser.Properties.PARSE_UNKNOWN_ELEMENTS);

    Parser parser = new Parser(configuration);
    parser.setEntityResolver(entityResolverProvider.getEntityResolver());

    WFSXmlUtils.initRequestParser(parser, wfs, geoServer, kvp);
    Object parsed = WFSXmlUtils.parseRequest(parser, reader, wfs);

    WFSXmlUtils.checkValidationErrors(parser, this);

    return parsed;
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

parser.setEntityResolver(entityResolverProvider.getEntityResolver());

代码示例来源:origin: org.geoserver/gs-wcs2_0

@SuppressWarnings("rawtypes")
  public Object read(Object request, Reader reader, Map kvp) throws Exception {
    // create the parser instance
    Parser parser = new Parser(configuration);
    parser.setEntityResolver(resolverProvider.getEntityResolver());

    // uncomment this once we have a working validator (now it fails due to
    // xlink issues)
    //        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 2.0.1 schema",
          e);
    }

    return parsed;
  }
}

代码示例来源:origin: org.geoserver.extension/gs-wcs2_0-eo-core

@SuppressWarnings("rawtypes")
  public Object read(Object request, Reader reader, Map kvp) throws Exception {
    // create the parser instance
    Parser parser = new Parser(configuration);
    parser.setEntityResolver(resolverProvider.getEntityResolver());

    // uncomment this once we have a working validator (now it fails due to
    // xlink issues)
    //        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 2.0.1 schema",
          e);
    }

    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.geotools/gt-wfs-ng

EntityResolver resolver = strategy.getConfig().getEntityResolver();
if (resolver != null) {
  parser.setEntityResolver(resolver);

代码示例来源:origin: org.geotools/gt-wfs-ng

EntityResolver resolver = strategy.getConfig().getEntityResolver();
if (resolver != null) {
  parser.setEntityResolver(resolver);

代码示例来源:origin: org.geotools/gt-wfs-ng

EntityResolver resolver = originatingRequest.getStrategy().getConfig().getEntityResolver();
if (resolver != null) {
  parser.setEntityResolver(resolver);

代码示例来源: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: geosdi/geo-platform

private Parser createSld11Parser(Object input, ResourceLocator resourceLocator, EntityResolver entityResolver) {
  if (resourceLocator == null && input instanceof File) {
    // setup for resolution of relative paths
    final java.net.URL surl = DataUtilities.fileToURL((File) input);
    DefaultResourceLocator defResourceLocator = new DefaultResourceLocator();
    defResourceLocator.setSourceUrl(surl);
    resourceLocator = defResourceLocator;
  }
  final ResourceLocator locator = resourceLocator;
  SLDConfiguration sld;
  if (locator != null) {
    sld = new SLDConfiguration() {
      protected void configureContext(org.picocontainer.MutablePicoContainer container) {
        container.registerComponentInstance(ResourceLocator.class, locator);
      }
    ;
  }  
    ;
  }
  else {
    sld = new SLDConfiguration();
  }
  Parser parser = new Parser(sld);
  if (entityResolver != null) {
     parser.setEntityResolver(entityResolver);
  }
  return parser;
}

代码示例来源:origin: org.geoserver.csw/gs-csw-core

parser.setFailOnValidationError(true);
parser.setValidating(true);
parser.setEntityResolver(resolverProvider.getEntityResolver());
parser.getNamespaces().declarePrefix("ogc", OGC.NAMESPACE);
Filter filter = (Filter) parser.parse(new StringReader(constraint));

代码示例来源:origin: org.geoserver/gs-wfs

@Override
public Object read(Object request, Reader reader, Map kvp) throws Exception {
  WFSConfiguration config = new WFSConfiguration();
  WFSXmlUtils.initWfsConfiguration(config, gs, new FeatureTypeSchemaBuilder.GML32(gs));
  Parser parser = new Parser(config);
  parser.setEntityResolver(entityResolverProvider.getEntityResolver());
  WFSInfo wfs = wfs();
  WFSXmlUtils.initRequestParser(parser, wfs, gs, kvp);
  Object parsed = null;
  try {
    parsed = WFSXmlUtils.parseRequest(parser, reader, wfs);
  } catch (Exception e) {
    // check the exception, and set code to OperationParsingFailed if code not set
    if (!(e instanceof ServiceException) || ((ServiceException) e).getCode() == null) {
      e = new WFSException("Request parsing failed", e, "OperationParsingFailed");
    }
    throw e;
  }
  WFSXmlUtils.checkValidationErrors(parser, this);
  return parsed;
}

代码示例来源:origin: org.geoserver/gs-wms

Parser parser = new Parser(new WFSConfiguration());
parser.setStrict(false);
parser.setEntityResolver(resolverProvider.getEntityResolver());
Object result = parser.parse(is);
if (result instanceof FeatureCollectionType) {

相关文章