code: void setRuleArg(XmlModelWriter xw, ValidatorRule rule, int argNum, Element element, String altMessageVar)
      {
          Integer argPosition = new Integer( argNum );
          ValidatorRule.MessageArg arg = rule.getArg( argPosition );
  
          if ( arg != null || altMessageVar != null )
          {
              String ruleName = rule.getRuleName();
              Element argElementToUse = getArgElement(xw, element, argNum, ruleName, true);
              
              if ( arg != null )
              {
                  String argMessage = arg.getMessage();
                  String key = arg.isKey() ? argMessage : ValidatorConstants.EXPRESSION_KEY_PREFIX + argMessage;
                  setElementAttribute(argElementToUse, "key", key);
                  setElementAttribute(argElementToUse, "resource", true);
                  if (arg.isKey() && _isValidatorOneOne) {
                      setElementAttribute(argElementToUse, "bundle", rule.getBundle());
                  }
              }
              else
              {
                  altMessageVar = "${var:" + altMessageVar + '}';
                  setElementAttribute(argElementToUse, "key", altMessageVar);
                  setElementAttribute(argElementToUse, "resource", "false");
              }
  
              setElementAttribute(argElementToUse, "name", ruleName);
          }
      }
docs: Set up the desired &lt;arg&gt; element and attributes for the given rule.
  
  @param rule the rule with the message and arg information to use
  @param argNum the position of the arg in the message
  @param element a <code>&lt;field&gt;</code> element in the validation XML to update
  @param altMessageVar alternative message var