com.google.gwt.xml.client.Node.getNodeValue()方法的使用及代码示例

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

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

Node.getNodeValue介绍

[英]This method retrieves the value.
[中]此方法检索值。

代码示例

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-wmsclient

protected String getValueRecursive(Node node) {
  if (node != null) {
    if (node.getNodeValue() != null) {
      return node.getNodeValue();
    }
    if (node.getFirstChild() != null) {
      return getValueRecursive(node.getFirstChild());
    }
  }
  return null;
}

代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl

protected String getValueRecursive(Node node) {
  if (node != null) {
    if (node.getNodeValue() != null) {
      return node.getNodeValue().trim();
    }
    if (node.getFirstChild() != null) {
      return getValueRecursive(node.getFirstChild());
    }
  }
  return null;
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-wmsclient

private boolean isQueryable(Node layerNode) {
  NamedNodeMap attributes = layerNode.getAttributes();
  Node q = attributes.getNamedItem("queryable");
  if (q != null) {
    return "1".equals(q.getNodeValue());
  }
  return false;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-management-web

@Nullable
private String getTextValue(@Nonnull final Node node) {
  Node child = node.getFirstChild();
  if (child != null && child.getNodeType() == TEXT_NODE) {
    return child.getNodeValue();
  }
  return null;
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-wmsclient

private boolean isQueryable(Node layerNode) {
  NamedNodeMap attributes = layerNode.getAttributes();
  Node q = attributes.getNamedItem("queryable");
  if (q != null) {
    return "1".equals(q.getNodeValue());
  }
  return false;
}

代码示例来源:origin: pentaho/data-access

private String getNodeValueByTagName( Node node, String tagName ) {
 if ( node != null && node.getFirstChild() != null ) {
  return node.getFirstChild().getNodeValue();
 } else {
  return null;
 }
}

代码示例来源:origin: com.googlecode.gwtupload/gwtupload

public static String getXmlNodeValue(Node node) {
 if (node.getNodeType() != Node.ELEMENT_NODE) {
  return null;
 }
 String ret = "";
 NodeList textNodes = node.getChildNodes();
 for (int i = 0; i < textNodes.getLength(); i++) {
  Node n = textNodes.item(i);
  if (n.getNodeType() == Node.TEXT_NODE
    && n.getNodeValue().replaceAll("[ \\n\\t\\r]", "").length() > 0) {
   ret += n.getNodeValue();
  } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
   ret += n.getNodeValue();
  }
 }
 return ret.length() == 0 ? null : ret.replaceAll("^\\s+", "").replaceAll("\\s+$", "");
}

代码示例来源:origin: org.apache.cxf/cxf-rt-management-web

private void setLink(@Nonnull final Node node) {
    Node typeNode = node.getAttributes().getNamedItem(TYPE_ATTRIBUTE);
    Node urlNode = node.getAttributes().getNamedItem(URL_ATTRIBUTE);
    if (typeNode != null && urlNode != null) {
      String typeValue = typeNode.getNodeValue();
      String urlValue = urlNode.getNodeValue();
      if (FIRST_LINK.equals(typeValue)) {
        first = urlValue;
      } else if (PREVIOUS_LINK.equals(typeValue)) {
        previous = urlValue;
      } else if (SELF_LINK.equals(typeValue)) {
        self = urlValue;
      } else if (NEXT_LINK.equals(typeValue)) {
        next = urlValue;
      } else if (LAST_LINK.equals(typeValue)) {
        last = urlValue;
      }
    }
  }
}

代码示例来源:origin: EmiteGWT/emite

@Override
public String getText() {
  final StringBuilder result = new StringBuilder();
  final NodeList nodes = element.getChildNodes();
  for (int i = 0; i < nodes.getLength(); i++) {
    final Node child = nodes.item(i);
    if (child.getNodeType() == Node.TEXT_NODE)
      result.append(child.getNodeValue());
  }
  return result.toString();
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

@Override
  @SuppressWarnings( { "cast", "unchecked" } )
  protected Map<String, String> getAttributesAsMap( Element element ) {

    NamedNodeMap nodes = element.getAttributes();

    int length = nodes.getLength();

    if ( length == 0 ) {
      return (Map<String, String>) Collections.EMPTY_MAP;
    }

    Map<String, String> attributes = new HashMap<String, String>( length );

    for ( int loop = 0; loop < length; loop++ ) {
      Node node = nodes.item( loop );
      attributes.put( node.getNodeName(), node.getNodeValue() );
    }

    return attributes;
  }
}

代码示例来源:origin: com.googlecode.gwtupload/gwtupload

public static String getXmlNodeValue(NodeList list, String tagName, int idx) {
 if (list == null || list.getLength() <= idx) {
  return null;
 }
 Node node = list.item(idx);
 if (node.getNodeType() != Node.ELEMENT_NODE) {
  return null;
 }
 String ret = "";
 NodeList textNodes = node.getChildNodes();
 for (int i = 0; i < textNodes.getLength(); i++) {
  Node n = textNodes.item(i);
  if (n.getNodeType() == Node.TEXT_NODE
    && n.getNodeValue().replaceAll("[ \\n\\t\\r]", "").length() > 0) {
   ret += n.getNodeValue();
  } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
   ret += n.getNodeValue();
  }
 }
 return ret.length() == 0 ? null : ret.replaceAll("^\\s+", "").replaceAll("\\s+$", "");
}

代码示例来源:origin: pentaho/data-access

private String getNodeValueByTagName( Element element, String tagName ) {
  Node node = getNodeByTagName( element, tagName );
  if ( node != null && node.getFirstChild() != null ) {
   return node.getFirstChild().getNodeValue();
  } else {
   return null;
  }
 }
}

代码示例来源:origin: pentaho/data-access

private String getNodeValueByTagName( Element element, String tagName ) {
  Node node = getNodeByTagName( element, tagName );
  if ( node != null && node.getFirstChild() != null ) {
   return node.getFirstChild().getNodeValue();
  } else {
   return null;
  }
 }
}

代码示例来源:origin: com.googlecode.gwtupload/gwtupload

Node attribute = node.getAttributes().getNamedItem(ATTR_BLOBSTORE_PARAM_NAME);
if (attribute != null) {
 String paramName = attribute.getNodeValue();
 if (paramName != null) {
  addHidden(paramName, value);

代码示例来源:origin: pentaho/data-access

public IDatabaseConnection convertToObject( String xml ) {
 Document document = XMLParser.parse( xml );
 Element element = document.getDocumentElement();
 IDatabaseConnection databaseConnection = new DatabaseConnection();
 databaseConnection.setDatabaseName( getNodeValueByTagName( element, DATABASE_NAME ) );
 databaseConnection.setHostname( getNodeValueByTagName( element, HOSTNAME ) );
 databaseConnection.setIndexTablespace( getNodeValueByTagName( element, INDEX_TABLESPACE ) );
 databaseConnection.setDataTablespace( getNodeValueByTagName( element, DATA_TABLESPACE ) );
 databaseConnection.setName( getNodeValueByTagName( element, NAME ) );
 databaseConnection.setUsername( getNodeValueByTagName( element, USERNAME ) );
 databaseConnection.setPassword( getNodeValueByTagName( element, PASSWORD ) );
 databaseConnection.setDatabasePort( getNodeValueByTagName( element, DATABASE_PORT ) );
 databaseConnection
  .setAccessType( DatabaseAccessType.getAccessTypeByName( getNodeValueByTagName( element, ACCESS_TYPE ) ) );
 databaseConnection.setDatabaseType(
  (DatabaseType) databaseTypeHelper.getDatabaseTypeByShortName( getNodeValueByTagName( element, DATABASE_TYPE ) ) );
 databaseConnection.setPassword( getNodeValueByTagName( element, PASSWORD ) );
 databaseConnection.setInformixServername( getNodeValueByTagName( element, SERVER_NAME ) );
 for ( Node node : getNodesByTagName( element, ATTRIBUTES ) ) {
  databaseConnection.getAttributes().put( node.getNodeName(), node.getNodeValue() );
 }
 return databaseConnection;
}

相关文章