A presentation by Robin Upton ( ) Latest version at Attribution – NonCommercial - ShareAlike FF106: Other Processing Directives Recommended Pre-requisite: FF6: Common Processing Directives v
F2F servers are programmed with items, with a function attribute to indicate which service is requested. Service Request Model The f2f:escaped & f2f:sendescaped attributes modify the default processing order. * This namespace is omitted for brevity from this point on. Attributes to modify requests are called Processing Directives. This presentation details the less common ones.
Interpreting a has 3 steps, apart from the transforms themselves. Processing Directive Sequence XSL transform or CORE service Raw Output Post- processed Output Pre- processed Input servicereq Raw Input servicereq Pre- processing directives: Mid- processing directives: pre-deserialize pre-validate pre-test {,-select} pre-skip pre-skip-shallow pre-update- {, -name, -namespace, -value} pre-order pre-sort {,-data-types,-keys,-order} pre-select pre-select-shallow this-return this-validate this-order this-skip this-skip-shallow this-update {, -name, -namespace, -value} this-sort {,-data-types, -keys, -order} this-select this-select-shallow this-xml-space this-escape this-escape-node this-insert {, -source{,-shallow}, -method} Raw Final Output Post- processed Final Output Post- processing directives: post-validate post-order post-skip post-skip-shallow post-update {,-name,-namespace, -value} post-sort {,-data-types, -keys, -order} post-select post-select-shallow post-xml-space post-escape-node Descendant XSL stylesheet Possible
Pre-Processing Directives pre-deserialize pre-validate pre-test pre-test-select pre-test-select-shallow pre-order pre-skip pre-skip-shallow pre-update- {, -name, -namespace, -value} pre-sort{,-data-types, -keys, -order} pre-select pre-select-shallow XSL transform or CORE service Pre- processed Input servicereq Raw Input servicereq Pre-processing directives: The following directives apply to the input document, before processing...
Mid-Processing Directives The following directives apply to the output of the first processing step... this-return this-validate this-order this-skip this-skip-shallow this-update {,-as,-namespace} this-sort {, -data-types, -keys, -order} this-select this-select-shallow this-xml-space this-escape this-escape-node this-insert {, -source{,-shallow}, -method} First XSL transform or CORE service Raw Output Post- processed Output Mid-processing directives:
Post-Processing Directives Post directives apply to the final output of all servicereqs created by the original request: post-validate post-order post-skip post-skip-shallow post-update {, -name, -namespace, -value} post-sort {,-data-types, -keys, -order} post-select post-select-shallow post-xml-space post-escape-node XSL transform or CORE service Raw Output Post- processed Output Mid-processing directives: Raw Final Output Post- processed Final Output Post-processing directives: Processing all offspring servicereqs. Descendant XSL stylesheets or CORE services
@pre-deserialize : Deserializing Text Nodes This converts serialized XML back into XML: pre ` <location>//false- flags.xml “//text()” is usually set to “//text()”, which deserializes all text nodes. It is used to allow continued processing of serialized XML content, such as that returned by calls to the f2f:core template.
@this-escape : Escaping with Attributes This specifies which output nodes to add escaping attributes to: mid ` is usually set to “/*”, to prevent any further processing. (Behaviour for “/” is currently “/*” Nodes which already have this attribute are unchanged.
@*-order : Modifying Order of Processing Directives This directive changes the order of subsequent processing directives. This directive is a superior alternative to attaching p.d.’s to a nested set of pre, mid, post <servicereq function=" this-select=”//f2f:item[2]” this-skip=”//f2f:item[2]” this-order=”select skip”> Reichstag Fire Sep 11th Attacks Tonkin “//f2f:item[2]” Sep 11th “//f2f:item[2]” Reichstag Fire Tonkin Gulf Tonkin Gulf Sep 11th Attacks
@this-return : Ignoring Return of Data If =0, this directive instructs the thread not to await the servicereq’s “0” is useful for operations which take a long time, such as callouts to other servers, since alternatives such wait for the service to complete. mid Although coded, it is not much needed yet, since F2F servers do not yet call out directly to other servers.
: Sorting This performs an XSL-style sort on the data. Both attributes are needed. pre, mid, avoids need for XSL sorting, especially handy for callouts. Reichstag Fire Sep 11th Attacks Tonkin Gulf Sep 11th Attacks Tonkin Gulf Reichstag “//f2f:list” Nodes whose children are sorted Semicolon-separated list of sort “1”Semicolon-separated list of is also available to specify sort(s) on ‘number’ or ‘text’.
` Example - reversing Node Order *-sort-keys may use any xpath. For example, to reverse child order: pre, mid, post //false-flags.xml Reichstag Fire Sep 11th Attacks Tonkin “//f2f:list” <!-- False Fag operations → Tonkin Gulf Sep 11th Attacks Reichstag Fire
@this-insert-* : Adding Input Branches This selects branches of input XML and appends it to the output. mid ` Reichstag Fire Sep 11th Attacks Tonkin Gulf //false-flags.xml 139 Reichstag Fire Sep 11th Attacks is analagous to the Unix “//f2f:list”
@this-insert-* : Calculating XPaths If this evaluates to a string, it is added to the output in the same way. mid ` Reichstag Fire Sep 11th Attacks Tonkin Gulf //false-flags.xml bytes, 3 item(s). If the Xpath result is a shallow are identical. If a node set, only the former keeps child “concat(‘ bytes,’, count(//f2f:item),’ item(s).’)”
@pre-test : Conditional Interpretation This directive is evaluated on the input document, and stops processing iff it evaluates to an empty node set, empty string, ‘false’ or ‘0’. pre “//f2f:item” If processing is is applied to the is barely used as yet, and may still be subject to change, such as throwing an exception on failure. = empty node set, so no processing
@ * -update : Modifying node values/names This attribute is an Xpath to specify nodes to modify. pre, mid, post The changes are processed in document order, important if the nodes refer to one another. e.g, A hierarchy of folders can be converted into a hierarchy of paths by using Attributes The modification is described by one or more of the Xpaths below, which are evaluated with respect to the @*-update-value New nameNew namespaceNew value Comments ignored New value CData ignored New value Elements New nameNew namespaceNew value P. I.’s New nameignoredNew value
@ * -validate : Validating Input/Output This regulates validation of particular calls. The value is either “*” (=no validation) or a URI of a service available on the soft-system. pre, mid, post ` are used internally if automatic validation is enabled. To suppress automatic input/midput/output validation of services, set the appropriate attribute= “*” in the module definition file. The only valid value of pre-validate which suppresses input validation. This may be helpful if input validation is undesirably strict (such as for the bag-read service, which requires numerical ids.
@ * -xml-space : Preserving Whitespace This adds an xml:space attribute to the top of the output: mid, post <!-- Transform here, which gets the width. --!> <!-- Transform here, which gets the height. --!> ` is for handling whitespace sensitive files (discouraged in “1”
//bad-servicereqs.xml //bad-servicereqs(copy).xml Safe Processing of Untrusted XML A common task is to handle any XML, without interpreting any servicereqs. adds f2f:escaped=”*” at the root element(s) so the contents will not be “/*”
Safe Processing of Unknown XML - 2 The f2f:file has f2f:escaped=“*”, so now the outer request is processed: Won’t be interpreted because of the above. ::sink.xml removes the escaping item before it is “f2f:data/f2f:file” //bad-servicereqs(copy).xml This request writes the data from the file without having processed its contents. //bad-servicereqs(copy).xml
Summary Recommended Follow-up: FF7: Server Structure Their efficiency and brevity means they should be used in preference to They modify the servicereq processing model and perform XML manipulations. Processing-directives are of 3 types, according to the order of evaluation. pre mid post