Gets the value of a node as a String, or null if it cannot be converted.
When it returns a non-null String, this method effectively emulates the
<code>String()</code> JavaScript cast function.
779780
public static String getStringValue(Node n) {
    // TODO(user): regex literals as well.
    switch (n.getToken()) {
      case STRING:
      case STRING_KEY:
        return n.getString();

      case TEMPLATELIT:
        // Only convert a template literal if all its expressions can be converted.
        String string = "";
        for (Node child = n.getFirstChild(); child != null; child = child.getNext()) {
          Node expression = child;
          if (child.isTemplateLitSub()) {
            expression = child.getFirstChild();
          }
          String expressionString = getStringValue(expression);
          if (expressionString == null) {
            // Cannot convert.
            return null;
          }
          string = string + expressionString;
        }
        return string;

      case TEMPLATELIT_STRING:
        return n.getCookedString();

      case NAME:
        String name = n.getString();
        if ("undefined".equals(name)
            || "Infinity".equals(name)
            || "NaN".equals(name)) {
          return name;
        }
        break;

      case NUMBER:
        return DToA.numberToString(n.getDouble());

      case FALSE:
        return "false";

      case TRUE:
        return "true";

      case NULL:
        return "null";

      case VOID:
        return "undefined";

      case NOT:
        TernaryValue child = getPureBooleanValue(n.getFirstChild());
        if (child != TernaryValue.UNKNOWN) {
          return child.toBoolean(true) ? "false" : "true"; // reversed.
        }
        break;

      case ARRAYLIT:
        return arrayToString(n);

      case OBJECTLIT:
        return "[object Object]";
      default:
        break;
    }
    return null;
  }
1304117
private Object value(Object obj, Element node) throws Exception {
		Object value = null;

		// Get the type
		String type = getAttribute(node, "type");

		// Try a ref lookup
		String ref = getAttribute(node, "ref");
		if (ref != null) {
			value = _idMap.get(ref);
		} else {
			// handle trivial case
			if (getChildren(node).length == 0
					&& (getValue(node) == null || getValue(node).length() == 0)) {
				if ("String".equals(type)) {
					return "";
				}
				return null;
			}

			// Trim values
			int first = 0;
			int last = /*
						 * getChildren(node).length - 1; int valLast =
						 */getValue(node).length() - 1;

			// Handle default trim type
			if (type == null || !"String".equals(type)) {
				// Skip leading white
				Object item = null;
				while (first <= last) {
					item = /*
							 * getChildren(node)[first]; val =
							 */getValue(node);
					if (!(item instanceof String)) {
						break;
					}
					item = ((String) item).trim();
					if (((String) item).length() > 0) {
						break;
					}
					first++;
				}

				// Skip trailing white
				while (first < last) {
					item = getValue(node);
					if (!(item instanceof String)) {
						break;
					}
					item = ((String) item).trim();
					if (((String) item).length() > 0) {
						break;
					}
					last--;
				}

				// All white, so return null
				if (first > last) {
					// first check if there are maybe is another child left
					if (getChildren(node).length == 0) {
						return null;
					} else {
						value = itemValue(obj, getChildren(node)[0]);
					}
				} else {
					value = item;
				}
			} else  if (first == last) {
	            // Single Item value
	            value = itemValue(obj,getChildren(node)[0]);
		    } else {
	            value = getValue(node);
	        }
		}
		
		

		// Untyped or unknown
		if (value == null) {
			if ("String".equals(type)) {
				return "";
			}
			return null;
		}

		// Try to type the object
		if (type == null) {
			if (value != null && value instanceof String) {
				return ((String) value).trim();
			}
			return value;
		}

		if ("String".equals(type) || "java.lang.String".equals(type)) {
			return value.toString();
		}

		Class<?> pClass = TypeUtil.fromName(type);
		if (pClass != null) {
			return TypeUtil.valueOf(pClass, value.toString());
		}

		if ("URL".equals(type) || "java.net.URL".equals(type)) {
			if (value instanceof URL) {
				return value;
			}
			try {
				return new URL(value.toString());
			} catch (MalformedURLException e) {
				throw new InvocationTargetException(e);
			}
		}

		if ("InetAddress".equals(type) || "java.net.InetAddress".equals(type)) {
			if (value instanceof InetAddress) {
				return value;
			}
			try {
				return InetAddress.getByName(value.toString());
			} catch (UnknownHostException e) {
				throw new InvocationTargetException(e);
			}
		}

		throw new IllegalStateException("Unknown type " + type);
	}
412876
public static String valueToString(Object value) {
		if (value == null) {
			return "null";
		} else if (!value.getClass().isArray()) {
			return value.toString();
		}

		StringBuilder sb = new StringBuilder();
		valueToString(sb, value);
		return sb.toString();
	}
1336182
def get_value(self, node):
        """"""
        if not isinstance(node, ast.Str):
            raise TypeError("must be a string literal")

        return node.s
582625
def to_string(node):
    
    with io.BytesIO() as f:
        write([node], f)
        return f.getvalue().decode('utf-8')
377355
private static void checkStringExprNode(@Nullable Node node) {
    if (node == null) {
      throw new IllegalArgumentException("Expected a string; found: null");
    }
    switch (node.getToken()) {
      case STRING:
      case TEMPLATELIT:
        break;
      case ADD:
        Node c = node.getFirstChild();
        checkStringExprNode(c);
        checkStringExprNode(c.getNext());
        break;
      default:
        throw new IllegalArgumentException("Expected a string; found: " + node.getToken());
    }
  }
1143058
def getString(t):
    
    slen = c_int()
    s = c_char_p()
    if PL_get_string_chars(t, byref(s), byref(slen)):
        return s.value
    else:
        raise InvalidTypeError("string")
1229355
function ValueToString(value) {
    if (value && typeof value === "object" && value.constructor === Array) {
      return JSON.stringify(value);
    }

    if (value && typeof value === "object" && value.constructor === Object) {
      return JSON.stringify(value);
    }

    /**
     * seeing some really weird cases where the above fail but "" + value
     * returns '[object Object]'
     */
    if (value && typeof value === "object") {
      return JSON.stringify(value);
    }

    if (value === null || typeof value === "undefined") {
      return "";
    }

    if (typeof value === "boolean") {
      if (value) {
        return "true";
      } else {
        return "false";
      }
    }

    if (typeof value === "number" && isFinite(value)) {
      return value.toString();
    }

    if (!!(value && value.constructor && value.call && value.apply)) {
      return value.toString();
    }

    return "" + value;
  }
496088
def stringGetNodeList(self, value):
        
        ret = libxml2mod.xmlStringGetNodeList(self._o, value)
        if ret is None:raise treeError('xmlStringGetNodeList() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
334168
public String getString()
    {
        Object objValue = null;
        if (this.getMessage() != null)
            objValue = this.getMessage().getNative(this.getFullKey(null));
        Class<?> classData = this.getRawClassType();
        try {
            return DataConverters.formatObjectToString(objValue, classData, this.getDefault());
        } catch (Exception ex) {
            return null;
        }
    }
167397
@SuppressWarnings("unchecked")
  public String getString(String name) {
    return ((Value<String>) getValue(name)).get();
  }
220080
function (xmlNode) {

            var rawValues = this.getRawValues(xmlNode);
            if (!rawValues) {
                return null;
            }

            var len = rawValues.length;

            var bufferData = new Uint32Array(len);
            for (var i = 0; i < len; i++) {
                bufferData[i] = parseInt(rawValues[i]);
            }

            return bufferData;
        }
800723
private String getString(DerValue attribute) throws IOException {
        if (attribute == null)
            return null;
        String  value = attribute.getAsString();

        if (value == null)
            throw new IOException("not a DER string encoding, "
                    + attribute.tag);
        else
            return value;
    }
1181747
function(node) {
        var data = {}

        var key = null
        for (var i = 0, len = node.childNodes.length; i < len; i++) {
            var child = node.childNodes[i]
            if (child.nodeType != ELEMENT_NODE) {
                continue
            }

            // Grab the key, next noe should be the value
            if (child.tagName == 'key') {
                key = child.firstChild.nodeValue
            } else {
                // Parse the value node
                data[key] = this._parseNode(child)
            }
        }


        return data
    }
596300
function getTextOfNode(node) {
        var result;
        if (node != null && node.childNodes[0]) {
            result = node.childNodes[0].nodeValue;
        } else if (node != null) {
            result = "";
        }
        return result;
    }
701689
public String getString (int index) {
        Object object = getObject (index);
        try {
            return (String) object;
        } catch (ClassCastException exception) {
            log.warn ("Cannot cast value type (" + object.getClass ().getName () + ") to String for index (" + index + ")");
        }
        return null;
    }
793650
function (xmlNode) {
            if (!xmlNode) {
                return;
            }
            var node = {};
            for (var i = 0; i < xmlNode.childNodes.length; i++) {
                var currNode = xmlNode.childNodes[i];

                // if it's a text node or a CDATA section use the nodeValue directly
                if (currNode.nodeType != 3 && currNode.nodeType != 4) {
                    var name = currNode.nodeName;
                    var count = 0;
                    for (var j = 0; j < xmlNode.childNodes.length; j++) {
                        if (xmlNode.childNodes[j].nodeName == name) {
                            if (++count == 2) {
                                break;
                            }
                        }
                    }
                    var el = this.__parseXmlNode(currNode);
                    if (count == 2) {
                        if (node[name] == null) {
                            node[name] = [];
                        }
                        node[name].push(el);
                    } else {
                        node[name] = el;
                    }

                } else if (xmlNode.childNodes.length == 1) {
                    node = currNode.nodeValue;
                }
            }
            return node;
        }