Expat Library
The library includes minimal numbers of functions of the Expat XML parser. When XML file contains non-ASCII characters, it should be processed line by line with each line encoded as UTF-8 string.
| Function | Parameter Type | Remark |
| expat() | Creates an object to handle xml stream using the EXPAT library. | |
| .version() | Returns EXPAT version string. | |
| .callback(start, end, data) | string, string, string | Sets callback functions to handle xml stream produced by the EXPAT object. As for the start callback, if the first argument is integer (indicating depth level), the second is a xml tag name; otherwise the two arguments are the key and value of a xml attribute. The end callback function should handle one argument as a closing xml tag. The data callback function should handle one argument as a string. |
| .parse(str) | string | Parses the xml string by the EXPAT object. |
Example
load("expat.dll");
function f1(a, b)
{
csv(a, b);
}
function f2(a)
{
csv(a);
}
function f3(a)
{
csv(a);
}
xml = expat();
xml.version();
xml.callback("f1", "f2", "f3");
xml.parse("<a>abc<b>ABC</b></a>");
