Parse and Import Use Case

Back to Language Syntax 

<p:pipeline xmlns:p="...">
    <p:declare-input port="dump-filename" name="file"/>
    <p:declare-output port="errors" ref="aggregated-errors"/>

    <p:step kind="vendor:parse-dump">
        <p:input port="filename" ref="file"/>
        <p:output port="documents" name="documents-to-import"/>
    </p:step>

    <p:for-each ref="documents-to-import" name="source-document">
        <p:for-each-output name="sequence-of-errors" ref="error"/>
        <p:step kind="p:validate">
            <p:input port="document" ref="source-document"/>
            <p:output port="validity" name="is-valid"/>
        </p:step>
        <p:choose ref="is-valid">
            <p:choose-output name="error" ref="error"/>
            <p:when test="/validity != 'true'">
                <p:step kind="db:xml-import">
                    <p:input port="input" ref="source-document"/>
                </p:step>
                <p:step kind="p:xslt">
                    <p:input port="stylesheet">
                        In-line stylesheet that generates a description of the error
                    </p:input>
                    <p:input port="input" ref="source-document"/>
                    <p:output port="output" name="error"/>
                </p:step>
            </p:when>
        </p:choose>
    </p:for-each>

    <p:step kind="p:aggregate">
        <p:input port="documents" ref="sequence-of-errors"/>
        <p:param port="root-element">errors</p:param>
        <p:output port="document" name="aggregated-errors"/>
    </p:step>

</p:pipeline>