code: protected void addContentValues(CmsXmlContent content, Locale locale, Map<String, String> contentValues)
      throws CmsXmlException {
  
          if (!content.hasLocale(locale)) {
              content.addLocale(m_cms, locale);
          }
          List<String> paths = new ArrayList<String>(contentValues.keySet());
          // first delete all null values
          // use reverse index ordering for similar elements
          Collections.sort(paths, new PathComparator(true));
          String lastDelete = "///";
          for (String path : paths) {
              // skip values where the parent node has been deleted
              if ((contentValues.get(path) == null) && !path.startsWith(lastDelete)) {
                  lastDelete = path;
  
                  deleteContentValue(content, locale, path);
              }
          }
          // now add the new or changed values
          // use regular ordering
          Collections.sort(paths, new PathComparator(false));
          for (String path : paths) {
              String value = contentValues.get(path);
              if (value != null) {
                  addContentValue(content, locale, path, value);
              }
          }
      }
docs: Adds the given values to the content document.<p>
  
  @param content the content document
  @param locale the content locale
  @param contentValues the values
  
  @throws CmsXmlException if writing the XML fails