In addition to the full set of XPath 2.0 functions, Text2XML also provides the following extension functions:
These functions are described in more detail below.
t2x:ParseDate() is a function which converts dates in different format to the standard XML Date format.
The syntax for t2x:ParseDate() is
t2x:ParseDate(dateString,pattern)
where
Examples of pattern include "DD-MM-YYYY" and "MM/DD/YY".
The length of the pattern must match the length of the date string to be converted, or an error will be returned.
The following example illustrates the usage of ParseDate (in real life, the input date would not be hard coded, but instead an XPath expression pointing to the date in the input XML file):
<MyXML xmlns:t2x="http://vmcsi.com/text2xml/2011/04/">
<ParseDateExample>
<Example t2x:value-of="t2x:ParseDate('01/31/2012','MM/DD/YYYY')"
t2x:xpath-result-type="string"/>
</ParseDateExample>
</MyXML>
The resulting output would be:
~~~~~~~~~
<myxml xmlns:t2x="http://vmcsi.com/text2xml/2011/04/">
<parsedateexample>
<example>2012-12-31</example>
</parsedateexample>
</myxml>
~~~~~~~~~~
t2x:ParseName() is a function which converts person names into a standardized name format with the structure lastname;firstname;middlename;suffix.
The syntax for t2x:ParseName() is:
t2x:ParseName(inputString, pattern)
where
Recognized suffixes include JR, SR, and III. The search for the suffix component is not case sensitive.
The FML and LMF may not work correctly when dealing with names containing more than three words (ie, "Mary Jane Ellen Smith"). In these cases, the extra words will always be added the middle name. Thus, the output of t2x:ParseName("Mary Jane Ellen Smith", "FML") would be "Smith;Mary;Jane Ellen").