code: public static void updateXml(CmsLink link, Element element, boolean updateOnly) {
  
          // if element is not null
          if (element != null) {
              if (!updateOnly || (element.element(CmsLink.NODE_TARGET) != null)) {
                  String strId = (link.getStructureId() == null ? null : link.getStructureId().toString());
                  // there may still be entities in the target, so we decode it
                  updateNode(element, CmsLink.NODE_TARGET, link.getTarget(), true);
                  updateNode(element, CmsLink.NODE_UUID, strId, false);
                  updateNode(element, CmsLink.NODE_ANCHOR, link.getAnchor(), true);
                  updateNode(element, CmsLink.NODE_QUERY, link.getQuery(), true);
              }
          }
      }
docs: Updates the link node in the underlying XML page document.<p>
  
  @param link the link to update
  @param element the &lt;link&gt; element to update
  @param updateOnly if set and the element has no {@link CmsLink#NODE_TARGET} subelement, so no action if executed at all