Function Definitions

Below is a list of all the functions supported by the JCAM processor. For all functions the first parameter is the xpath of the element or attribute to which the rule is being applied. By default all elements or attributes are treated as mandatory unless a rule overriding this is applied.

  • makeMandatory(xpath) - sets the elements or attributes to mandatory - this is the default rule. Can be used with conditions to override other rules.
  • makeOptional(xpath) - set the element or attribute to optional. If the element or attribute exist in the file it must have sensible content. Empty fields are not the same as optional.
  • makeRepeatable(xpath) - indicate that the element (not allowed for attributes) can be repeated.
  • setLimit(xpath,limit) - indicates that the repeating of an element may only occur upto the value of 'limit'.
  • setLength(xpath,length) - set the limits of the size of the text for and element or attribute. Longth may be either a single number e.g. 10 or a pair of number of the format min-max e.g. 20-30.
  • setID(xpath) - associate an ID with the current element or attribute - has no real usage in JCAM
  • setValue(xpath,value) - sets the text content of the the element or attribute to the given 'value'. This is the same as including the 'value' in the structure without the surrounding % symbols.
  • setChoice(xpath) - sets all the elements pointed to by the xpath as being part of a choice. Usually the xpath uses the children indicator '*'
  • restrictValues(xpath,values,defaultValue) - this causes the content of an element or attribute to be restricted to one of the 'values' provided. The values are given using the format 'value1'|'value2' etc. The dafaultValue must be one of the values provided.
  • setStringMask(xpath,mask) - the content of the element or attribute must conform to the mask provided.
  • setDateMask(xpath,mask) - the content of the element or attribute must conform to the mask provided.
  • setNumberMask(xpath,mask) - the content of the element or attribute must conform to the mask provided.
  • useAttribute(xpath) - indicates that an attribute should be included in the document being checked.
  • useElement(xpath) - indicates that an element should be included in the document being checked.
  • useTree(xpath) - indicates that a set of elements should be included in the document being checked.
  • excludeAttribute(xpath) - indicates that an attribute should be excluded from the document being checked
  • excludeElement(xpath) - indicates that an element should be excluded from the document being checked
  • excludetree(xpath) - indicates that an tree should be excluded from the document being checked
  • orderChildren(xpath) - indicates that the cildren must occur in the order they appear in the structure. With the Lax validator order is not normally enforced.
  • allowAnyContent(xpath) - indicates that the element may contain any content including XML elements. The content will not be validated.

    There is one extra function provided by JCAM that is not in the CAM specification

  • lookup(xpath,lookupListName,filter) - this is similar to the restrictValues, except that the list of values is given in an external file. For more details on lists see Lookup Lists