Section - 1 : Scenarios


Scenario 1

A Documaker Server program, such as GenData, loads an XML document and extracts the XML tree at the transaction level using the XMLFileExtract rule. This rule creates a list type DAL variable with a default name of %extract and pushes it onto the DAL stack.

Then you can call other XML API functions in a DAL script to access the XML tree and extract XML data.

Here are examples of the form set and image rules you would add and a DAL script that would call the XML API functions.

  • Add this in the AFGJOB.JDT file:

    ;XMLFileExtract;2;File=.\deflib\test.xml

    The rule loads the XML file and creates a list type DAL variable to pass the XML tree to the XML API function.

  • Add this in your DDT file:

    ;0;0;DALXMLSCRIPT;0;9;DALXMLSCRIPT;0;9;;DAL;Call("TEST.DAL");N;N;N;N;4792;19444;11010;

    TEST.DAL is the name of the DAL script file.

  • Here is an example of the DAL script:

    %listH=XMLFind(%extract, “Forms”, “Form”);

    #rc=XMLFirst(%listH);

    if #rc=0

    return(“Failed to XMLFirst”);

    end

    aStr=XMLGetCurText(%listH);

    return(aStr);

    %listH denotes a list type DAL variable. #rc denotes an integer type DAL variable. aStr denotes a string type DAL variable.

Scenario 2

You can also load the XML document and create the XML tree at a specific image field by calling the LoadXMLList rule from a DAL script. You must set the calling procedure in the DDT file as shown in Scenario 1.

Here is an example of DAL script file:

%xListH=LoadXMLList("test.xml");

%listH=XMLFind(%xListH,"Forms","Form/@*");

aStr=XMLNthAttrValue(%listH,2);

#rc=DestroyList(%xListH);

return(aStr);