Function XMLDocSetAction() Professional
Set action code blocks for specific tags.
XMLDocSetAction( <nDocHandle>, <cNode>, <bAction> ) --> nTagCount
{|cTagName, xTagContent, xTagAttr, nTagHandle| ... } --> nAction
Parameter | Value |
---|---|
cTagName | Name of the tag as character string. |
xTagContent | Content of XML tag as character string or NIL. |
xTagAttr | Two-column array holding name/value pairs for tag attributes, or NIL if the tag has no attributes. |
nTagHandle | Numeric tag handle. |
Constant | Description |
---|---|
XML_PROCESS_ABORT | Aborts execution of other action code blocks |
XML_PROCESS_CONTINUE | Executes next action codeblock |
The function returns the number of tags, or nodes, matching the string <cNode>.
This function registers a code block in the parser engine and defines the nodes in the XML document for which the code block <bAction>must be evaluated. The code block usually calls a user-defined function which implements the action for the parser engine when it finds a matching node.
To explain the required syntax for <cNode>, the following XML code is used:
<?xml version="1.0"?>
<Configuration>
<DatabaseEngines>
<load>DBFDBE</load>
<load>NTXDBE</load>
<load>CDXDBE</load>
<build name="DBFNTX">
<data>DBFDBE</data>
<order>NTXDBE</order>
</build>
<build name="DBFCDX">
<data>DBFDBE</data>
<order>CDXDBE</order>
</build>
</DatabaseEngines>
<DynamicDLLs>
<load>MyFirstDLL</load>
<load>MySecondDLL</load>
</DynamicDLLs>
</Configuration>
To pass the contents of the various XML tags to the action code block, the following node strings could be used for <cNode>.
<cNode>: /Configuration/DatabaseEngines/build/order
Result: NTXDBE, CDXDBE
<cNode>: //DatabaseEngines/build/order
Result: NTXDBE, CDXDBE
<cNode>: //data
Result: DBFDBE, DBFDBE
<cNode>: /Configuration//load
Result: DBFDBE, NTXDBE, DBEDBE, CDXDBE, MyFirstDLL, MySecondDLL
<cNode>: //DynamicDLLs//load
Result: MyFirstDLL, MySecondDLL
The first node string in this example defines a complete path to the data embedded in the <order> tags. The following examples demonstrate the meaning of the double slash. "//" is interpreted like a wildcard that matches any possible path. This means that "//" alone matches all nodes, while "/Configuration//load" matches all <load> tags appearing within the root tag of the example. In this case, "//" matches the tags <DatabaseEngines> and <DynamicDLLs>.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.