Compute the string-value of a node.
510928
def string_value(node):
    """"""
    if (node.nodeType == node.DOCUMENT_NODE or
        node.nodeType == node.ELEMENT_NODE):
        s = u''
        for n in axes['descendant'](node):
            if n.nodeType == n.TEXT_NODE:
                s += n.data
        return s

    elif node.nodeType == node.ATTRIBUTE_NODE:
        return node.value

    elif (node.nodeType == node.PROCESSING_INSTRUCTION_NODE or
          node.nodeType == node.COMMENT_NODE or
          node.nodeType == node.TEXT_NODE):
        return node.data
501290
private String getStringValue(Node node) {
        switch (node.getNodeType()) {
            case Node.ATTRIBUTE_NODE:
            case Node.TEXT_NODE:
                return node.getNodeValue();
            default: {
                try {
                    Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
                    StringWriter buffer = new StringWriter();
                    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
                    transformer.transform(new DOMSource(node), new StreamResult(buffer));
                    return buffer.toString();
                } catch (Exception e) {
                }
                return null;
            }
        }
    }
145892
def _eval_num(self, node):
        
        if self.floats:
            return node.n
        else:
            return int(node.n)
712624
def visit_Expr(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        return self.visit(node.value)
730635
def getValueByName(node, name):
    

    try:
        value = node.xpath("*[local-name() = '%s']" % name)[0].text.strip()
    except:
        return None
    return value
84966
def _nodes_to_values(self):
        
        def is_none(slice):
            return slice[0] == -1 and slice[1] == -1

        def get(slice):
            return self.string[slice[0]:slice[1]]

        return [(varname, get(slice), slice) for varname, slice in self._nodes_to_regs() if not is_none(slice)]
1074967
def construct_getatt(node):
    

    if isinstance(node.value, six.text_type):
        return node.value.split(".", 1)
    elif isinstance(node.value, list):
        return [s.value for s in node.value]
    else:
        raise ValueError("Unexpected node type: {}".format(type(node.value)))
775471
def value( self, node, parent=None ):
        """"""
        # this is the *weighted* size/contribution of the node 
        try:
            return node['contribution']
        except KeyError, err:
            contribution = int(node.get('totsize',0)/float( len(node.get('parents',())) or 1))
            node['contribution'] = contribution
            return contribution
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
    }
1253328
def visit_Str(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        return repr(node.s)
1216524
def _validate_node_name(self, var_value):
        """"""
        # pylint: disable=R0201
        var_values = var_value if isinstance(var_value, list) else [var_value]
        for item in var_values:
            if (not isinstance(item, str)) or (
                isinstance(item, str)
                and (
                    (" " in item)
                    or any(
                        [
                            element.strip() == ""
                            for element in item.strip().split(self._node_separator)
                        ]
                    )
                )
            ):
                return True
        return False
897079
def get(self, key, value=None):
        ""
        _key = self._prepare_key(key)
        prefix, node = self._get_node_by_key(_key)
        if prefix==_key and node.value is not None:
            return self._unpickle_value(node.value)
        else:
            return value
1260886
function (node) {
            if (isText(node)) {
                return node.nodeValue.length;
            }

            if (node) {
                return node.childNodes.length;
            }

            return 0;

        }
582625
def to_string(node):
    
    with io.BytesIO() as f:
        write([node], f)
        return f.getvalue().decode('utf-8')
1163795
def visit_Constant(self, node):
        """"""
        nnode = self.dnode(node)
        node.first_line, node.first_col = ast_pos(nnode, self.bytes_pos_to_utf8)
        node.last_line = node.first_line
        node.last_col = node.first_col + len(repr(node.value))
        node.uid = (node.last_line, node.last_col)
987254
private String getStringValue(Object o) {
        if (o instanceof String) {
            return (String) o;
        } else if (o instanceof NodeArray) {
            NodeArray array = (NodeArray) o;
            switch (array.size()) {
                case 0:
                    return null;
                case 1: {
                    return getStringValue(array.get(0));
                }
                default:
                    return getStringValue(array);
            }
        } else if (o instanceof Node) {
            return getStringValue((Node) o);
        } else if (o != null) {
            return o.toString();
        }
        return null;
    }
183671
protected void parse(Node node) {
		NodeList childNodes = node.getChildNodes();
		for (int i = 0; i < childNodes.getLength(); i++) {
			Node child = childNodes.item(i);
			String nodeName = child.getNodeName();
			if ("Name".equalsIgnoreCase(nodeName)) {
				name = getValueRecursive(child);
			} else if ("Title".equalsIgnoreCase(nodeName)) {
				title = getValueRecursive(child);
			} else if ("Abstract".equalsIgnoreCase(nodeName)) {
				abstractt = getValueRecursive(child);
			} else if ("LegendURL".equalsIgnoreCase(nodeName)) {
				legendUrl = createLegendInfo(child);
			}
		}
	}