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

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

本文整理了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

  1. protected String getValueRecursive(Node node) {
  2. if (node != null) {
  3. if (node.getNodeValue() != null) {
  4. return node.getNodeValue();
  5. }
  6. if (node.getFirstChild() != null) {
  7. return getValueRecursive(node.getFirstChild());
  8. }
  9. }
  10. return null;
  11. }

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

  1. protected String getValueRecursive(Node node) {
  2. if (node != null) {
  3. if (node.getNodeValue() != null) {
  4. return node.getNodeValue().trim();
  5. }
  6. if (node.getFirstChild() != null) {
  7. return getValueRecursive(node.getFirstChild());
  8. }
  9. }
  10. return null;
  11. }

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

  1. private boolean isQueryable(Node layerNode) {
  2. NamedNodeMap attributes = layerNode.getAttributes();
  3. Node q = attributes.getNamedItem("queryable");
  4. if (q != null) {
  5. return "1".equals(q.getNodeValue());
  6. }
  7. return false;
  8. }

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

  1. @Nullable
  2. private String getTextValue(@Nonnull final Node node) {
  3. Node child = node.getFirstChild();
  4. if (child != null && child.getNodeType() == TEXT_NODE) {
  5. return child.getNodeValue();
  6. }
  7. return null;
  8. }

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

  1. private boolean isQueryable(Node layerNode) {
  2. NamedNodeMap attributes = layerNode.getAttributes();
  3. Node q = attributes.getNamedItem("queryable");
  4. if (q != null) {
  5. return "1".equals(q.getNodeValue());
  6. }
  7. return false;
  8. }

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

  1. private String getNodeValueByTagName( Node node, String tagName ) {
  2. if ( node != null && node.getFirstChild() != null ) {
  3. return node.getFirstChild().getNodeValue();
  4. } else {
  5. return null;
  6. }
  7. }

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

  1. public static String getXmlNodeValue(Node node) {
  2. if (node.getNodeType() != Node.ELEMENT_NODE) {
  3. return null;
  4. }
  5. String ret = "";
  6. NodeList textNodes = node.getChildNodes();
  7. for (int i = 0; i < textNodes.getLength(); i++) {
  8. Node n = textNodes.item(i);
  9. if (n.getNodeType() == Node.TEXT_NODE
  10. && n.getNodeValue().replaceAll("[ \\n\\t\\r]", "").length() > 0) {
  11. ret += n.getNodeValue();
  12. } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
  13. ret += n.getNodeValue();
  14. }
  15. }
  16. return ret.length() == 0 ? null : ret.replaceAll("^\\s+", "").replaceAll("\\s+$", "");
  17. }

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

  1. private void setLink(@Nonnull final Node node) {
  2. Node typeNode = node.getAttributes().getNamedItem(TYPE_ATTRIBUTE);
  3. Node urlNode = node.getAttributes().getNamedItem(URL_ATTRIBUTE);
  4. if (typeNode != null && urlNode != null) {
  5. String typeValue = typeNode.getNodeValue();
  6. String urlValue = urlNode.getNodeValue();
  7. if (FIRST_LINK.equals(typeValue)) {
  8. first = urlValue;
  9. } else if (PREVIOUS_LINK.equals(typeValue)) {
  10. previous = urlValue;
  11. } else if (SELF_LINK.equals(typeValue)) {
  12. self = urlValue;
  13. } else if (NEXT_LINK.equals(typeValue)) {
  14. next = urlValue;
  15. } else if (LAST_LINK.equals(typeValue)) {
  16. last = urlValue;
  17. }
  18. }
  19. }
  20. }

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

  1. @Override
  2. public String getText() {
  3. final StringBuilder result = new StringBuilder();
  4. final NodeList nodes = element.getChildNodes();
  5. for (int i = 0; i < nodes.getLength(); i++) {
  6. final Node child = nodes.item(i);
  7. if (child.getNodeType() == Node.TEXT_NODE)
  8. result.append(child.getNodeValue());
  9. }
  10. return result.toString();
  11. }

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

  1. @Override
  2. @SuppressWarnings( { "cast", "unchecked" } )
  3. protected Map<String, String> getAttributesAsMap( Element element ) {
  4. NamedNodeMap nodes = element.getAttributes();
  5. int length = nodes.getLength();
  6. if ( length == 0 ) {
  7. return (Map<String, String>) Collections.EMPTY_MAP;
  8. }
  9. Map<String, String> attributes = new HashMap<String, String>( length );
  10. for ( int loop = 0; loop < length; loop++ ) {
  11. Node node = nodes.item( loop );
  12. attributes.put( node.getNodeName(), node.getNodeValue() );
  13. }
  14. return attributes;
  15. }
  16. }

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

  1. public static String getXmlNodeValue(NodeList list, String tagName, int idx) {
  2. if (list == null || list.getLength() <= idx) {
  3. return null;
  4. }
  5. Node node = list.item(idx);
  6. if (node.getNodeType() != Node.ELEMENT_NODE) {
  7. return null;
  8. }
  9. String ret = "";
  10. NodeList textNodes = node.getChildNodes();
  11. for (int i = 0; i < textNodes.getLength(); i++) {
  12. Node n = textNodes.item(i);
  13. if (n.getNodeType() == Node.TEXT_NODE
  14. && n.getNodeValue().replaceAll("[ \\n\\t\\r]", "").length() > 0) {
  15. ret += n.getNodeValue();
  16. } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
  17. ret += n.getNodeValue();
  18. }
  19. }
  20. return ret.length() == 0 ? null : ret.replaceAll("^\\s+", "").replaceAll("\\s+$", "");
  21. }

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

  1. private String getNodeValueByTagName( Element element, String tagName ) {
  2. Node node = getNodeByTagName( element, tagName );
  3. if ( node != null && node.getFirstChild() != null ) {
  4. return node.getFirstChild().getNodeValue();
  5. } else {
  6. return null;
  7. }
  8. }
  9. }

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

  1. private String getNodeValueByTagName( Element element, String tagName ) {
  2. Node node = getNodeByTagName( element, tagName );
  3. if ( node != null && node.getFirstChild() != null ) {
  4. return node.getFirstChild().getNodeValue();
  5. } else {
  6. return null;
  7. }
  8. }
  9. }

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

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

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

  1. public IDatabaseConnection convertToObject( String xml ) {
  2. Document document = XMLParser.parse( xml );
  3. Element element = document.getDocumentElement();
  4. IDatabaseConnection databaseConnection = new DatabaseConnection();
  5. databaseConnection.setDatabaseName( getNodeValueByTagName( element, DATABASE_NAME ) );
  6. databaseConnection.setHostname( getNodeValueByTagName( element, HOSTNAME ) );
  7. databaseConnection.setIndexTablespace( getNodeValueByTagName( element, INDEX_TABLESPACE ) );
  8. databaseConnection.setDataTablespace( getNodeValueByTagName( element, DATA_TABLESPACE ) );
  9. databaseConnection.setName( getNodeValueByTagName( element, NAME ) );
  10. databaseConnection.setUsername( getNodeValueByTagName( element, USERNAME ) );
  11. databaseConnection.setPassword( getNodeValueByTagName( element, PASSWORD ) );
  12. databaseConnection.setDatabasePort( getNodeValueByTagName( element, DATABASE_PORT ) );
  13. databaseConnection
  14. .setAccessType( DatabaseAccessType.getAccessTypeByName( getNodeValueByTagName( element, ACCESS_TYPE ) ) );
  15. databaseConnection.setDatabaseType(
  16. (DatabaseType) databaseTypeHelper.getDatabaseTypeByShortName( getNodeValueByTagName( element, DATABASE_TYPE ) ) );
  17. databaseConnection.setPassword( getNodeValueByTagName( element, PASSWORD ) );
  18. databaseConnection.setInformixServername( getNodeValueByTagName( element, SERVER_NAME ) );
  19. for ( Node node : getNodesByTagName( element, ATTRIBUTES ) ) {
  20. databaseConnection.getAttributes().put( node.getNodeName(), node.getNodeValue() );
  21. }
  22. return databaseConnection;
  23. }

相关文章