Conversion Functions

You can write your own custom conversion function and specify this conversion function in a recording rule. The conversion function is contained in a native DLL file (programmed in C/C++). Within the conversion function, the value in the parsing rule is converted using the specified function, while the parsing function only parses the original value.

For example, when values are returned by the server in a double format they are sent by the client in an integer format. Therefore, a simple parsing rule will not find any matches in the script. However by applying a custom conversion function that converts the integer to a double format, the parsing rule is able to find the expected matches again.

Note: A conversion function can only be specified for HTTP Parsing Rules.

Sample Recording Rule

Below is an example of a recording rule with the conversion function specified.

<RecordingRuleSet>
  <HttpParsingRule>
    <Name>Parse by Boundaries, Convert and Replace (with custom conversion DLL)</Name>
    <Search>
      <SearchIn type="Select{Body|Header|All}">Body</SearchIn>
      <LB>
        <Str>&gt;</Str>
      </LB>
      <RB>
        <Str>&lt;/strong&gt;</Str>
      </RB>
      <Conversion>
        <Dll>SampleConversion.dll</Dll>
        <Function>ConvertToUpperCase</Function>
      </Conversion>
    </Search>
    <ScriptGen>
      <ReplaceIn type="MultiSelect{FormFieldValue|Url|PostedData}">FormFieldV alue, Url, PostedData</ReplaceIn>
      <VarName>ParsedByBoundary</VarName>
      <GenDebugPrint>true</GenDebugPrint>
      <Conversion>
        <BdlFunction>MyConvertToUpperCase</BdlFunction>
      </Conversion>
    </ScriptGen>
  </HttpParsingRule>
</RecordingRuleSet>