docs: private static void insertElement(Document pDocument, String pName, Object pValue, String pFormat) {
  
      // Get names of all elements we need
      String[] names = StringUtil.toStringArray(pName, ".");
  
      // Get value formatted as string
      String value = null;
  
      if (pValue != null) {
        // ---
        if (pValue instanceof Date) {
  
          // Special threatment of Date
          if (pFormat != null) {
            value = new SimpleDateFormat(pFormat).format(pValue);
          }
          else {
            value = sDefaultFormat.format(pValue);
          }
        }
        else {
          value = String.valueOf(pValue);
        }
  
        // ---
      }
  
      // Loop through document from root, and insert parents as needed
      Element element = pDocument.getDocumentElement();
  
      for (int i = 0; i < names.length; i++) {
        boolean found = false;
  
        // Get children
        NodeList children = element.getElementsByTagName(PROPERTY);
        Element  child    = null;
  
        // Search for correct name
        for (int j = 0; j < children.getLength(); j++) {
          child = (Element) children.item(j);
          if (names[i].equals(child.getAttribute(PROPERTY_NAME))) {
            // Found
            found   = true;
            element = child;
            break;  // Next name
          }
        }
  
        // Test if the node was not found, otherwise we need to insert
        if (!found) {
          // Not found
          child = pDocument.createElement(PROPERTY);
          child.setAttribute(PROPERTY_NAME, names[i]);
  
          // Insert it
          element.appendChild(child);
          element = child;
        }
  
        // If it's the destination node, set the value
        if ((i + 1) == names.length) {
  
          // If the value string contains special data,
          // use a CDATA block instead of the "value" attribute
          if (StringUtil.contains(value, "\n") || StringUtil.contains(value, "\t") || StringUtil.contains(value, "\"")
                  || StringUtil.contains(value, "&") || StringUtil.contains(value, "<") || StringUtil.contains(value, ">")) {
  
            // Create value element
            Element valueElement = pDocument.createElement(PROPERTY_VALUE);
  
            // Set type attribute
            String className = pValue.getClass().getName();
  
            className = StringUtil.replace(className, "java.lang.", "");
            if (!DEFAULT_TYPE.equals(className)) {
              valueElement.setAttribute(PROPERTY_TYPE, className);
            }
  
            // Set format attribute
            if (pFormat != null) {
              valueElement.setAttribute(PROPERTY_FORMAT, pFormat);
            }
  
            // Crate cdata section
            CDATASection cdata = pDocument.createCDATASection(value);
  
            // Append to document tree
            valueElement.appendChild(cdata);
            child.appendChild(valueElement);
          }
          else {
            // Just set normal attribute value
            child.setAttribute(PROPERTY_VALUE, value);
  
            // Set type attribute
            String className = pValue.getClass().getName();
  
            className = StringUtil.replace(className, "java.lang.", "");
            if (!DEFAULT_TYPE.equals(className)) {
              child.setAttribute(PROPERTY_TYPE, className);
            }
  
            // If format is set, store in attribute
            if (pFormat != null) {
              child.setAttribute(PROPERTY_FORMAT, pFormat);
            }
          }
        }
      }
    }