org.geotools.xsd.Node.getAttributeValue()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(152)

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

Node.getAttributeValue介绍

[英]Helper method for access to the parsed value of the attribute whose parsed value is an instance of clazz. In the event that the node contains multple attributes matching the above criteria, the first encountered is returned, with no guaratnee of order. For all values matching this criteria use #getAttributeValues(Class).
[中]用于访问其解析值为clazz实例的属性的解析值的Helper方法。如果节点包含与上述条件匹配的多个属性,则返回第一个遇到的属性,而不保证顺序。对于所有符合此条件的值,请使用#GetAttributeValue(类)。

代码示例

代码示例来源:origin: geoserver/geoserver

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. *
  5. * @param value an instance of {@link GetCapabilitiesType} (possibly a subclass) if a binding
  6. * for a specific service's GetCapabilities request used {@link Binding#BEFORE} {@link
  7. * #getExecutionMode() execution mode}, and thus relies on this binding to fill the common
  8. * properties. <code>null</code> otherwise.
  9. * <!-- end-user-doc -->
  10. * @generated modifiable
  11. */
  12. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  13. GetCapabilitiesType getCapabilities;
  14. if ((value != null) && value instanceof GetCapabilitiesType) {
  15. getCapabilities = (GetCapabilitiesType) value;
  16. } else {
  17. getCapabilities = owsfactory.createGetCapabilitiesType();
  18. }
  19. getCapabilities.setAcceptVersions(
  20. (AcceptVersionsType) node.getChildValue(AcceptVersionsType.class));
  21. getCapabilities.setSections((SectionsType) node.getChildValue(SectionsType.class));
  22. getCapabilities.setAcceptFormats(
  23. (AcceptFormatsType) node.getChildValue(AcceptFormatsType.class));
  24. getCapabilities.setUpdateSequence((String) node.getAttributeValue("updateSequence"));
  25. return getCapabilities;
  26. }
  27. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. return factory.featureId(node.getAttributeValue("fid").toString());
  10. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. String name = (String) value;
  10. // &lt;xsd:attribute name="nArgs" type="xsd:string" use="required"/&gt;
  11. String nargs = (String) node.getAttributeValue("nArgs");
  12. return factory.functionName(name, Integer.parseInt(nargs));
  13. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. // &lt;xsd:attribute ref="gml:id" use="required"/&gt;
  10. return filterfactory.gmlObjectId((String) node.getAttributeValue("id"));
  11. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. * Sets the service feature of the object passed in.
  3. *
  4. * <p>The service value is retreived as an attribute from the node, if <code>null</code>, the
  5. * default "WFS" is used.
  6. *
  7. * @param object An object which contains a feature named "service"
  8. * @param node The parse node.
  9. */
  10. public static void service(EObject object, Node node) {
  11. String service = (String) node.getAttributeValue("service");
  12. if (service == null) {
  13. service = "WFS";
  14. }
  15. set(object, "service", service);
  16. }

代码示例来源:origin: geotools/geotools

  1. @Override
  2. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  3. Double minx = Double.valueOf((String) node.getAttributeValue("minx"));
  4. Double miny = Double.valueOf((String) node.getAttributeValue("miny"));
  5. Double maxx = Double.valueOf((String) node.getAttributeValue("maxx"));
  6. Double maxy = Double.valueOf((String) node.getAttributeValue("maxy"));
  7. WGS84BoundingBoxType bbox = Ows10Factory.eINSTANCE.createWGS84BoundingBoxType();
  8. bbox.setCrs("EPSG:4326");
  9. bbox.setDimensions(BigInteger.valueOf(2));
  10. bbox.setLowerCorner(Arrays.asList(minx, miny));
  11. bbox.setUpperCorner(Arrays.asList(maxx, maxy));
  12. return bbox;
  13. }
  14. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. * Sets the outputFormat feature of the object passed in.
  3. *
  4. * <p>The outputFormat value is retreived as an attribute from the node, if <code>null</code>,
  5. * the default <code>default</code> is used.
  6. *
  7. * @param object An object which contains a feature named "version"
  8. * @param node The parse node.
  9. */
  10. public static void outputFormat(EObject object, Node node, String defalt) {
  11. String outputFormat = (String) node.getAttributeValue("outputFormat");
  12. if (outputFormat == null) {
  13. outputFormat = defalt;
  14. }
  15. set(object, "outputFormat", outputFormat);
  16. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. * Sets the version feature of the object passed in.
  3. *
  4. * <p>The version value is retreived as an attribute from the node, if <code>null</code>, the
  5. * default "1.0.0" is used.
  6. *
  7. * @param object An object which contains a feature named "version"
  8. * @param node The parse node.
  9. */
  10. public static void version(EObject object, Node node) {
  11. String version = (String) node.getAttributeValue("version");
  12. if (version == null) {
  13. version = "1.0.0";
  14. }
  15. set(object, "version", version);
  16. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. URLTemplateType template = factory.createURLTemplateType();
  10. template.setFormat((String) node.getAttributeValue("format"));
  11. // TODO: find resourceType binding?
  12. // template.setResourceType((String) node.getAttributeValue("resourceType"));
  13. template.setTemplate((String) node.getAttributeValue("template"));
  14. return template;
  15. }
  16. }

代码示例来源:origin: geotools/geotools

  1. private RequestMethodType createRequestMethodType(
  2. Ows10Factory ows10Factory, Node getOrPostNode) {
  3. RequestMethodType methodType = ows10Factory.createRequestMethodType();
  4. String href = (String) getOrPostNode.getAttributeValue("onlineResource");
  5. methodType.setHref(href);
  6. return methodType;
  7. }
  8. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. CssParameter parameter = new CssParameter((String) node.getAttributeValue("name"));
  10. parameter.setExpression((Expression) value);
  11. return parameter;
  12. }
  13. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. // &lt;xsd:element minOccurs="0" name="GeometryOperands"
  10. // type="ogc:GeometryOperandsType"/&gt;
  11. GeometryOperand[] gos = (GeometryOperand[]) node.getChildValue(GeometryOperand[].class);
  12. // &lt;xsd:attribute name="name" type="ogc:SpatialOperatorNameType"/&gt;
  13. return factory.spatialOperator((String) node.getAttributeValue("name"), gos);
  14. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. // &lt;xsd:element ref="se:StringValue"/&gt;
  10. Expression str = (Expression) node.getChildValue("StringValue");
  11. // &lt;xsd:attribute name="stripOffPosition" type="se:stripOffPositionType"/&gt;
  12. Expression pos = filterFactory.literal(node.getAttributeValue("stripOffPosition"));
  13. // &lt;xsd:attribute name="stripOffChar" type="xsd:string"/&gt;
  14. Expression ch = filterFactory.literal(node.getAttributeValue("stripOffChar"));
  15. return filterFactory.function("strTrim2", str, pos, ch);
  16. }
  17. }

代码示例来源:origin: geotools/geotools

  1. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  2. ComplexDataType data = factory.createComplexDataType();
  3. if (node.hasAttribute("schema")) {
  4. data.setSchema(node.getAttributeValue("schema").toString());
  5. }
  6. if (node.hasAttribute("mimeType")) {
  7. data.setMimeType(node.getAttributeValue("mimeType").toString());
  8. }
  9. if (node.hasAttribute("encoding")) {
  10. data.setEncoding(node.getAttributeValue("encoding").toString());
  11. }
  12. for (Iterator i = node.getChildren().iterator(); i.hasNext(); ) {
  13. Node c = (Node) i.next();
  14. data.getData().add(c.getValue());
  15. }
  16. return data;
  17. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. // TODO: units
  10. Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory);
  11. double distance = ((Double) node.getChildValue("Distance")).doubleValue();
  12. Object units = node.getChild("Distance").getAttributeValue("units");
  13. return filterFactory.dwithin(
  14. operands[0], operands[1], distance, units == null ? null : units.toString());
  15. }
  16. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory);
  10. double distance = ((Double) node.getChildValue(Double.class)).doubleValue();
  11. Object units = node.getChild("Distance").getAttributeValue("units");
  12. return filterFactory.beyond(
  13. operands[0], operands[1], distance, units == null ? null : units.toString());
  14. }
  15. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. Double d = Double.valueOf(node.getComponent().getText());
  10. URI uom = (URI) node.getAttributeValue(URI.class);
  11. if (uom != null) {
  12. return new Measure(d.doubleValue(), new BaseUnit(uom.toString()));
  13. }
  14. return new Measure(d.doubleValue(), null);
  15. }

代码示例来源:origin: geotools/geotools

  1. @Override
  2. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  3. CssParameter option = new CssParameter((String) node.getAttributeValue("name"));
  4. option.setExpression(filterFactory.literal(instance.getText()));
  5. return option;
  6. }
  7. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. GeoPackageProcessRequest.Layer layer = parseLayer(instance, node, value);
  10. layer.setName((String) node.getAttributeValue("name"));
  11. layer.setIdentifier((String) node.getAttributeValue("identifier"));
  12. layer.setBbox((Envelope) node.getChildValue("bbox"));
  13. layer.setDescription((String) node.getChildValue("description"));
  14. layer.setSrs((URI) node.getChildValue("srs"));
  15. return layer;
  16. }
  17. }

代码示例来源:origin: geotools/geotools

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. Envelope envelope = (Envelope) node.getChildValue("envelope");
  10. String body = (String) node.getChildValue("body");
  11. BigInteger id = (BigInteger) node.getAttributeValue("id");
  12. List atts = node.getChildValues("attachment");
  13. Attachment[] attachments = (Attachment[]) atts.toArray(new Attachment[atts.size()]);
  14. return new Mail(id, body, envelope, attachments);
  15. }

相关文章