Map all child nodes to one object's attributes
488385
def nodes_to_object(self, node, object):
        ""

        for n in list(node):
            self.node_to_object(n, object)
1329707
def apply_attributes(node: Node, **_):
    """"""
    for attr in node.xml_node.attrs:
        apply_attribute(node, attr)
483678
function getAllChildSpans(node) {
  return (
    Array.isArray(node.children)
      ? node.children
          .map(n => (n.spans || []).concat(getAllChildSpans(n)))
          .reduce((all, arr) => all.concat(arr))
      : []
  );
}
818347
function Node(name, type) {
      this.name = name;
      this.type = type;

      if (type === 1) {
        this.attributes = [];
        this.attributes.map = {};
      }
    }
994990
private Map<String, String> toMetadata( NodeList blocks ) {
        Map<String, String> dimensions = new HashMap<String, String>();

        for( int i = 0; i < blocks.getLength(); i++ ) {
            Node dimensionNode = blocks.item(i);

            if( dimensionNode.getNodeName().equals("member") ) {
                String dimensionName = null;
                String dimensionValue = null;

                NodeList dimensionAttributes = dimensionNode.getChildNodes();
                for( int j = 0; j < dimensionAttributes.getLength(); j++ ) {
                    Node attribute = dimensionAttributes.item(j);
                    String name = attribute.getNodeName();

                    if( name.equals("Name") ) {
                        dimensionName = provider.getTextValue(attribute);
                    }
                    else if( name.equals("Value") ) {
                        dimensionValue = provider.getTextValue(attribute);
                    }
                }
                if( dimensionName != null ) {
                    dimensions.put(dimensionName, dimensionValue);
                }
            }
        }

        if( dimensions.size() == 0 ) {
            return null;
        }
        return dimensions;
    }
306006
def append_children(self, content):
        
        for child in content.node:
            cont = Content(child)
            cval = self.append(cont)
            key = reserved.get(child.name, child.name)
            if key in content.data:
                v = getattr(content.data, key)
                if isinstance(v, list):
                    v.append(cval)
                else:
                    setattr(content.data, key, [v, cval])
                continue
            if self.multi_occurrence(cont):
                if cval is None:
                    setattr(content.data, key, [])
                else:
                    setattr(content.data, key, [cval,])
            else:
                setattr(content.data, key, cval)
1001006
function flattenChildren(children) {
  if (children == null) {
    return children;
  }
  var result = {};
  traverseAllChildren(children, flattenSingleChildIntoContext, result);
  return result;
}
739463
function(obj, node) {
        var children = node.childNodes;
        var childNode, processor, prefix, local;
        for(var i=0, len=children.length; i<len; ++i) {
            childNode = children[i];
            if(childNode.nodeType == 1) {
                prefix = this.getNamespacePrefix(childNode.namespaceURI);
                local = childNode.nodeName.split(":").pop();
                processor = this["read_" + prefix + "_" + local];
                if(processor) {
                    processor.apply(this, [obj, childNode]);
                }
            }
        }
    }
1000104
function loadChildNodes(parentNode){
    if (gNodesWithChildren[parentNode._id]){
        var children = [];
        for (var i = 0; i < gNodesWithChildren[parentNode._id].length; ++i){
            var currentNode = gNodesWithChildren[parentNode._id][i];
            children.push({
                _id : currentNode._id, //todo : id instead of name?
                node : currentNode,
                parent : parentNode._id, //todo id instead of name?
                childNodes : loadChildNodes(currentNode)
            });
        }
        return children;
    }
}
247945
def export(self, node):
        """"""
        attriter = self.attriter or (lambda attr_values: attr_values)
        return self.__export(node, self.dictcls, attriter, self.childiter)
984238
private static Map<String, String> getAttributeMap(
      Node parent, String nodeName, String keyAttributeName, String valueAttributeName)
      throws AppEngineException {

    Map<String, String> nameValueAttributeMap = new HashMap<>();
    if (parent.hasChildNodes()) {
      for (int i = 0; i < parent.getChildNodes().getLength(); i++) {
        Node child = parent.getChildNodes().item(i);
        NamedNodeMap attributeMap = child.getAttributes();

        if (nodeName.equals(child.getNodeName()) && attributeMap != null) {
          Node keyNode = attributeMap.getNamedItem(keyAttributeName);

          if (keyNode != null) {
            Node valueNode = attributeMap.getNamedItem(valueAttributeName);
            try {
              nameValueAttributeMap.put(keyNode.getTextContent(), valueNode.getTextContent());
            } catch (DOMException ex) {
              throw new AppEngineException(
                  "Failed to parse value from attribute node " + keyNode.getNodeName(), ex);
            }
          }
        }
      }
    }

    return nameValueAttributeMap;
  }
77730
def _nodes(output, parent=None):
    """"""
    # NOTE refactor so all outputs behave the same
    entity = getattr(output, 'entity', output)

    if isinstance(entity, Collection):
        for member in entity.members:
            if parent is not None:
                member = attr.evolve(member, parent=parent)
            yield from _nodes(member)
        yield output
    else:
        yield output
1128350
function getChildMapping(children) {
  if (!children) {
    return children;
  }
  var result = {};
  _react.Children.map(children, function (child) {
    return child;
  }).forEach(function (child) {
    result[child.key] = child;
  });
  return result;
}
80952
function all(h, parent) {
  const nodes = parent.children || []
  const { length } = nodes
  const values = []
  let index = -1

  while (++index < length) {
    const result = one(h, nodes[index], parent)
    values.push(result)
  }

  return values.filter(node => node)
}
28641
function mapAttrName(node, text, maps, id, nodeId, isComponent)
  {
    var attrs = text.match(__matchAttr),
        mapText,
        mapValues,
        attr,
        title,
        value,
        item,
        len = attrs.length,
        titleMap,
        localMap,
        x = 0,
        lenn,
        i = 0;
    
    for(x;x<len;x++)
    {
      attr = attrs[x].split(':');
      title = attr[0];
      value = attr[1].replace(__replaceSingleQuotes, '');
      
      if(title.match(__matchInsert))
      {
        titleMap = new mapObject({
          local_id: id,
          node_id: nodeId,
          mapIndex: maps.length,
          mapTextIndex: 0,
          text: title,
          maps: maps,
          mapText: [title],
          type: 'attr',
          isInsert: true,
          node: node,
          isAttr: true,
          isPointer: isComponent,
          isProperty: true
        })
        maps.push(titleMap)
        titleMap.mapText = [maps[(maps.length - 1)]];
      }
      else if(title.match(__matchText))
      {
        titleMap = new mapObject({
          local_id: id,
          node_id: nodeId,
          mapIndex: maps.length,
          mapTextIndex: 0,
          text: title,
          maps: maps,
          mapText: [title],
          type: 'attr',
          node: node,
          isAttr: true,
          listener: 'setAttribute',
          local: node,
          isPointer: isComponent,
          isProperty: true
        })
        maps.push(titleMap);
        titleMap.mapText = [maps[(maps.length - 1)]];
      }
      
      mapText = splitText(value);
      mapValues = (titleMap ? titleMap.mapValues : maps);
      lenn = mapText.length;
      i = 0;
      
      for(i;i<lenn;i++)
      {
        item = mapText[i];
        if(item.match(__matchInsert))
        {
          localMap = new mapObject({
            local_id: id,
            node_id: nodeId,
            mapIndex: mapValues.length,
            mapTextIndex: i,
            text: item,
            mapText: mapText,
            maps: mapValues,
            type: 'attr',
            isInsert: true,
            property: title,
            listener: title,
            node: node,
            isAttr: true,
            isPointer: isComponent,
            isPropertyValue: true
          });
          titleMap.mapValues.push(localMap)
        }
        else if(item.match(__matchText))
        {
          localMap = new mapObject({
            local_id: id,
            node_id: nodeId,
            mapIndex: mapValues.length,
            mapTextIndex: i,
            text: item,
            mapText: mapText,
            maps: mapValues,
            type: 'attr',
            property: title,
            listener: title,
            node: node,
            isAttr: true,
            isPointer: isComponent,
            isPropertyValue: true
          });
          titleMap.mapValues.push(localMap)
        }
        else
        {
          localMap = item;
        }
        mapText[i] = localMap;
      }
      titleMap.values = mapText;
    }
  }
725361
def dump_children(self, obj):
        """"""
        data, errors = PIDSchema(many=True).dump(
            obj.children.ordered('asc').all())
        return data
764882
def getAllNodeUids(self):
        '''
            
        '''
        ret = set()

        for child in self:
            ret.update(child.getAllNodeUids())

        return ret