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

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

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

Node.hasAttribute介绍

[英]Determines if the node has an attribute whose value is of the specified class.
[中]确定节点是否具有值属于指定类的属性。

代码示例

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

  1. public void initializeChildContext(
  2. ElementInstance childInstance, Node node, MutablePicoContainer context) {
  3. // if an srsName is set for this geometry, put it in the context for
  4. // children, so they can use it as well
  5. if (node.hasAttribute("srsName")) {
  6. try {
  7. CoordinateReferenceSystem crs = GML2ParsingUtils.crs(node);
  8. if (crs != null) {
  9. context.registerComponentInstance(CoordinateReferenceSystem.class, crs);
  10. }
  11. } catch (Exception e) {
  12. throw new RuntimeException(e);
  13. }
  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. if (value instanceof Geometry) {
  10. Geometry geometry = (Geometry) value;
  11. // &lt;attribute name="srsName" type="anyURI" use="optional"/&gt;
  12. if (node.hasAttribute("srsName")) {
  13. URI srs = (URI) node.getAttributeValue("srsName");
  14. CoordinateReferenceSystem crs = CRS.decode(srs.toString());
  15. if (crs != null) {
  16. geometry.setUserData(crs);
  17. } else {
  18. logger.warning("Could not create Coordinate Reference System for " + srs);
  19. }
  20. }
  21. // TODO: process the ID attribute
  22. }
  23. return value;
  24. }

代码示例来源: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. List l = node.getChildValues(Symbolizer.class);
  10. Symbolizer[] syms = (Symbolizer[]) l.toArray(new Symbolizer[l.size()]);
  11. FeatureTypeStyle style = sb.createFeatureTypeStyle(syms, 1.0, 1.0);
  12. // if the style has an id, throw it in to the style cache
  13. if (node.hasAttribute("id")) {
  14. String id = (String) node.getAttributeValue("id");
  15. // create a uri with just a fragment
  16. URI uri = new URI("#" + id);
  17. styleMap.put(uri, style);
  18. }
  19. return style;
  20. }
  21. }

代码示例来源: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 e1 = (Expression) node.getChildValue(0);
  10. Expression e2 = (Expression) node.getChildValue(1);
  11. // &lt;xsd:attribute default="true" name="matchCase" type="xsd:boolean" use="optional"/&gt;
  12. Boolean matchCase = Boolean.TRUE;
  13. if (node.hasAttribute("matchCase")) {
  14. matchCase = (Boolean) node.getAttributeValue("matchCase");
  15. }
  16. return filterfactory.equal(e1, e2, matchCase.booleanValue());
  17. }
  18. }

代码示例来源: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 e1 = (Expression) node.getChildValue(0);
  10. Expression e2 = (Expression) node.getChildValue(1);
  11. // filter 1.1 only
  12. // &lt;xsd:attribute default="true" name="matchCase" type="xsd:boolean" use="optional"/&gt;
  13. Boolean matchCase = Boolean.TRUE;
  14. if (node.hasAttribute("matchCase")) {
  15. matchCase = (Boolean) node.getAttributeValue("matchCase");
  16. }
  17. return filterfactory.notEqual(e1, e2, matchCase.booleanValue());
  18. }
  19. }

代码示例来源: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. UpdateElementType updateElement = wfsfactory.createUpdateElementType();
  10. // &lt;xsd:element maxOccurs="unbounded" ref="wfs:Property"&gt;
  11. updateElement.getProperty().addAll(node.getChildValues(PropertyType.class));
  12. // &lt;xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter"&gt;
  13. updateElement.setFilter((Filter) node.getChildValue(Filter.class));
  14. // &lt;xsd:attribute name="handle" type="xsd:string" use="optional"&gt;
  15. if (node.hasAttribute("handle")) {
  16. updateElement.setHandle((String) node.getAttributeValue("handle"));
  17. }
  18. // &lt;xsd:attribute name="typeName" type="xsd:QName" use="required"&gt;
  19. updateElement.setTypeName((QName) node.getAttributeValue("typeName"));
  20. // &lt;xsd:attribute default="x-application/gml:3" name="inputFormat"
  21. // type="xsd:string" use="optional"&gt;
  22. if (node.hasAttribute("inputFormat")) {
  23. updateElement.setInputFormat((String) node.getAttributeValue("inputFormat"));
  24. }
  25. // &lt;xsd:attribute name="srsName" type="xsd:anyURI" use="optional"&gt;
  26. if (node.hasAttribute("srsName")) {
  27. updateElement.setSrsName((URI) node.getAttributeValue("srsName"));
  28. }
  29. return updateElement;
  30. }

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

  1. if (node.hasAttribute("idgen")) {
  2. insertElement.setIdgen(
  3. (IdentifierGenerationOptionType) node.getAttributeValue("idgen"));
  4. if (node.hasAttribute("handle")) {
  5. insertElement.setHandle((String) node.getAttributeValue("handle"));
  6. if (node.hasAttribute("inputFormat")) {
  7. insertElement.setInputFormat((String) node.getAttributeValue("inputFormat"));
  8. if (node.hasAttribute("srsName")) {
  9. insertElement.setSrsName((URI) node.getAttributeValue("srsName"));

代码示例来源: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. DeleteElementType deleteElement = wfsfactory.createDeleteElementType();
  10. // &lt;xsd:element maxOccurs="1" minOccurs="1" ref="ogc:Filter"&gt;
  11. deleteElement.setFilter((Filter) node.getChildValue(Filter.class));
  12. // &lt;xsd:attribute name="handle" type="xsd:string" use="optional"/&gt;
  13. if (node.hasAttribute("handle")) {
  14. deleteElement.setHandle((String) node.getAttributeValue("handle"));
  15. }
  16. // &lt;xsd:attribute name="typeName" type="xsd:QName" use="required"/&gt;
  17. deleteElement.setTypeName((QName) node.getAttributeValue(QName.class));
  18. return deleteElement;
  19. }
  20. }

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

  1. sym.setDescription((Description) node.getChildValue("Description"));
  2. if (node.hasAttribute("uom")) {
  3. String uom = ((URI) node.getAttributeValue("uom")).toString();
  4. if (UomOgcMapping.get(uom) == null) {

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

  1. String featureTypeId = null;
  2. if (node.hasAttribute("id")) {
  3. featureTypeId = (String) node.getAttributeValue("id");
  4. if (node.hasAttribute("name")) {
  5. featureTypeName = (String) node.getAttributeValue("name");
  6. } else if (featureTypeId != null) {

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

  1. RectifiedGridType grid = Gml4wcsFactory.eINSTANCE.createRectifiedGridType();
  2. if (node.hasAttribute("srsName")) {
  3. grid.setSrsName(node.getAttributeValue("srsName").toString());

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

  1. if (node.hasAttribute("decimalPoint")) {
  2. expressions[3] = filterFactory.literal(node.getAttributeValue("decimalPoint"));
  3. } else {
  4. if (node.hasAttribute("groupingSeparator")) {
  5. expressions[4] = filterFactory.literal(node.getAttributeValue("groupingSeparator"));
  6. } else {

相关文章