Copy the "data-semantic-id" attribute to "id", if it does not exist.
Will recursively go over every child.

@param readNode element to change
493804
void copyIdField(Element readNode) {
        String newId = readNode.getAttribute("data-semantic-id");
        if (!StringUtils.isEmpty(newId)) {
            readNode.setAttribute("id", "p" + newId);
        }
        for (Node child : new NonWhitespaceNodeList(readNode.getChildNodes())) {
            if (child instanceof Element) {
                copyIdField((Element) child);
            }
        }
    }
1236578
public void setRootNode(TreeElement rootNode)
    {
        _rootNode = rootNode;
        if (rootNode.getName() == null) {
            rootNode.setName("0");
        }
    }
371309
@Override
    protected void initPrototypeId(int id) {
        String s;
        int arity;
        switch (id) {
            case Id_constructor: {
                IdFunctionObject ctor;
                if (this instanceof XML) {
                    ctor = new XMLCtor((XML)this, XMLOBJECT_TAG, id, 1);
                } else {
                    ctor = new IdFunctionObject(this, XMLOBJECT_TAG, id, 1);
                }
                initPrototypeConstructor(ctor);
                return;
            }

            case Id_addNamespace:      arity=1; s="addNamespace";      break;
            case Id_appendChild:       arity=1; s="appendChild";       break;
            case Id_attribute:         arity=1; s="attribute";         break;
            case Id_attributes:        arity=0; s="attributes";        break;
            case Id_child:             arity=1; s="child";             break;
            case Id_childIndex:        arity=0; s="childIndex";        break;
            case Id_children:          arity=0; s="children";          break;
            case Id_comments:          arity=0; s="comments";          break;
            case Id_contains:          arity=1; s="contains";          break;
            case Id_copy:              arity=0; s="copy";              break;
            case Id_descendants:       arity=1; s="descendants";       break;
            case Id_elements:          arity=1; s="elements";          break;
            case Id_hasComplexContent: arity=0; s="hasComplexContent"; break;
            case Id_hasOwnProperty:    arity=1; s="hasOwnProperty";    break;
            case Id_hasSimpleContent:  arity=0; s="hasSimpleContent";  break;
            case Id_inScopeNamespaces: arity=0; s="inScopeNamespaces"; break;
            case Id_insertChildAfter:  arity=2; s="insertChildAfter";  break;
            case Id_insertChildBefore: arity=2; s="insertChildBefore"; break;
            case Id_length:            arity=0; s="length";            break;
            case Id_localName:         arity=0; s="localName";         break;
            case Id_name:              arity=0; s="name";              break;
            case Id_namespace:         arity=1; s="namespace";         break;
            case Id_namespaceDeclarations:
                arity=0; s="namespaceDeclarations"; break;
            case Id_nodeKind:          arity=0; s="nodeKind";          break;
            case Id_normalize:         arity=0; s="normalize";         break;
            case Id_parent:            arity=0; s="parent";            break;
            case Id_prependChild:      arity=1; s="prependChild";      break;
            case Id_processingInstructions:
                arity=1; s="processingInstructions"; break;
            case Id_propertyIsEnumerable:
                arity=1; s="propertyIsEnumerable"; break;
            case Id_removeNamespace:   arity=1; s="removeNamespace";   break;
            case Id_replace:           arity=2; s="replace";           break;
            case Id_setChildren:       arity=1; s="setChildren";       break;
            case Id_setLocalName:      arity=1; s="setLocalName";      break;
            case Id_setName:           arity=1; s="setName";           break;
            case Id_setNamespace:      arity=1; s="setNamespace";      break;
            case Id_text:              arity=0; s="text";              break;
            case Id_toString:          arity=0; s="toString";          break;
            case Id_toSource:          arity=1; s="toSource";          break;
            case Id_toXMLString:       arity=1; s="toXMLString";       break;
            case Id_valueOf:           arity=0; s="valueOf";           break;

            default: throw new IllegalArgumentException(String.valueOf(id));
        }
        initPrototypeMethod(XMLOBJECT_TAG, id, s, arity);
    }
379046
public final void replaceChild(Node child, Node newChild) {
    checkArgument(newChild.next == null, "The new child node has next siblings.");
    checkArgument(newChild.previous == null, "The new child node has previous siblings.");
    checkArgument(newChild.parent == null, "The new child node already has a parent.");
    checkState(child.parent == this, "%s is not the parent of %s", this, child);

    // Copy over important information.
    newChild.useSourceInfoIfMissingFrom(child);
    newChild.parent = this;

    Node nextSibling = child.next;
    Node prevSibling = child.previous;

    Node last = first.previous;

    if (child == prevSibling) {  // first and only child
      first = newChild;
      first.previous = newChild;
    } else {
      if (child == first) {
        first = newChild;
        // prevSibling == last, and last.next remains null
      } else {
        prevSibling.next = newChild;
      }

      if (child == last) {
        first.previous = newChild;
      } else {
        nextSibling.previous = newChild;
      }

      newChild.previous = prevSibling;
    }
    newChild.next = nextSibling;  // maybe null

    child.next = null;
    child.previous = null;
    child.parent = null;
  }
398124
public void retainNode(String id) {
        synchronized (retainedNodes) {
            Node current = getCurrentNode();

            if (current != null) {
                retainedNodes.put(id, current);
            }
        }
    }
305031
public static void setVersion(JsonNode node, Long version) {
		obj(node).put(ID_VERSION, version);
	}
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;
        }
1203167
function(cloneNode){
							cloneNode.contentAssistProposalIndex = node.contentAssistProposalIndex;
							if (cloneNode.hasChildNodes()) {
								for (var i = 0 ; i < cloneNode.childNodes.length ; i++){
									recursiveSetIndex(cloneNode.childNodes[i]);
								}
							}
						}
864360
protected void readDataOutput(org.w3c.dom.Node xmlNode, StartNode startNode) {
        String id = ((Element) xmlNode).getAttribute("id");
        String outputName = ((Element) xmlNode).getAttribute("name");
        dataOutputs.put(id, outputName);
    }
284808
@Override
	protected void parse(Node node) {
		NamedNodeMap attributes = node.getAttributes();
		title = getValueRecursive(attributes.getNamedItem("title"));
		srs = getValueRecursive(attributes.getNamedItem("srs"));
		profile = getValueRecursive(attributes.getNamedItem("profile"));
		href = getValueRecursive(attributes.getNamedItem("href"));
		setParsed(true);
	}
230805
public void copyAttributes(Document doc, Element eold, Element enew) {
    if(eold.hasAttributes()) {
      NamedNodeMap attr = eold.getAttributes();
      int len = attr.getLength();
      for(int i = 0; i < len; i++) {
        enew.setAttributeNode((Attr) doc.importNode(attr.item(i), true));
      }
    }
  }
320731
public static Node searchNodeById(Node rootNode, int nodeId) {
        if (rootNode.getNodeId() == nodeId) {
            return rootNode;
        }
        Node foundNode = null;
        for (Node n : rootNode.getChilds()) {
            foundNode = searchNodeById(n, nodeId);
            if (foundNode != null) {
                break;
            }
        }
        return foundNode;
    }
274976
function XmlNode(name, children) {
    if (children === void 0) { children = []; }
    this.name = name;
    this.children = children;
    this.attributes = {};
}
730691
protected void visitChildProperties(NodeData node) throws RepositoryException
   {
      if (isInterrupted())
         return;
      for (PropertyData data : dataManager.getChildPropertiesData(node))
      {
         if (isInterrupted())
            return;
         data.accept(this);
      }
   }
858314
private void genNode(final Element ent, final ResourceXMLParser.Entity entity) {
        for (final String nodeProp : nodeProps) {
            ent.addAttribute(nodeProp, notNull(entity.getProperty(nodeProp)));
        }
        genAttributes(ent, entity);
    }
1112747
public void removeChild(AttributeId attribute) {
      if (children == null) {
         throw new IllegalArgumentException("No child found : " + attribute);
      }
      AttributeNode<AttributeMetadata, AttributeId> child = children.get(attribute);
      if (child == null) {
         throw new IllegalArgumentException("No child found : " + attribute);
      }
      children.remove(attribute);
      rebuildChildrenArray();
   }
1040155
protected void addNode( Node nodeToInsert, Node insertBeforeNode )
    {
        // Insert node.
        nodeToInsert.next = insertBeforeNode;
        nodeToInsert.previous = insertBeforeNode.previous;
        insertBeforeNode.previous.next = nodeToInsert;
        insertBeforeNode.previous = nodeToInsert;
    }