code: private void setIdsAndAttribs(
              Element parent, String labelBase, String index, String precedence) {
          NodeList children = parent.getChildNodes();
  
          for (int i = 0; i < children.getLength(); i++) {
              if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
                  Element child = (Element) children.item(i);
                  String id = child.getAttribute(Constants.ATT_ID);
                  if (!id.equals("")) {
                      String newId = labelBase + id;
                      child.setAttribute(Constants.ATT_ID, newId);
                      child.setIdAttribute(Constants.ATT_ID, true);
                      child.setAttributeNS(Constants.NS_URI, Constants.ATT_FRAGMENT, index);
                      child.setAttributeNS(Constants.NS_URI, Constants.ATT_PRECEDENCE, precedence);
                      setIdsAndAttribs(child, labelBase, index, precedence);
                  }
              }
          }
      }
docs: Recursive method that passes through a layout tree and changes all ids from the regular
  format of sXX or nXX to the globally safe incorporated id of form uXlXsXX or uXlXnXX
  indicating the user id and layout id from which this node came.