code: public void assignData(XEvent event, String data) {
                  if (data != null && data.trim().length() > 0) {
                          XAttributeLiteral attr = (XAttributeLiteral) ATTR_DATA.clone();
                          attr.setValue(data.trim());
                          event.getAttributes().put(KEY_DATA, attr);
                  }
          }
docs: Assigns the data attribute value for a given event.
  
  @param event Event to be modified.
  @param data Data string to be assigned.