Parent Harvester
The Marshal Parent harvester is used to harvest data from the parent query element. You can use this harvester to build complex elements, e.g. for creating a file element with a name attribute, a size attribute and an MD5 attribite.
Parent harvester example
Say that you create a model that lists documents, including binary content and document name. Since you cannot store binary content in XML files, you need to decide how you want to handle the binaries. You could of course just add an
Embed Base 64 data processor or a
Save as file data processor to your leaf. However, if you want to create a complex file element with multiple attributes, the Parent harvester comes in handy.
Image 1, Example model
Notice that the Content node is yellow. This indicates that something is wrong and that the user needs to take action. Hover the cursor over the node to display the error message. In this case the problem is that the node holds binary data and we have not yet decided how this should be handled.
You can of course always add a new Query-node that uses the Parent harvester and add the leaves of your choise, but in the case of creating a file element from a blob, there is a shortcut.
Image 2, Create File Element
Right click on the blob leaf in the tree, and select the Create File Element menu option. Marshal will now create a file element for you with different attributes depending on whether or not you have chosen to use XLink for file references in the root node.
Image 3, File reference namespace
If the Use XLink for file references property is set to false, the following file element is created.
Image 4, Use XLink for file references is false
The Content leaf is now red, indicating that the Export property is set to false. This means that the data of the node is available during execution, but it will not be exported to XML. Instead a Query-element, with the same name as the original leaf, in this case Content, has been created, and four attribute leaves have been added to this node.
- The File attribute leaf. This leaf contains the binary data, and a Save as file data processor has automatically been added to this node. This means that after export, the file is stored on disk, and the File attribute contains the relative path to the file. Notice that the node is green. This means that the creation property for the node is set to Auto, meaning that the node is created and populated by the harvester.
- The MD5Hash attribute leaf. An MD5 data processor, that calculates the MD5-sum of the file binary content, has automatically been added to this leaf. Notice that the node is blue. This indicates that the creation property for the node is set to Manual. This means that the node is not created by the harvester, but rather by the data processor.
- The Name attribute leaf. The node is red, indicating that the Export property is set to false. The content of the node is used by the Save as file data parser, added to the File attribute, to store the files with proper file names. The Name attribute itself is how ever not exported.
- The Size attribute leaf. A Size data processor, calculating the size of the binary content, has been added to this node. Notice that the node is blue indicating that the node is created using a data parser rather than by the harvester.
If the Use XLink for file references property is set to true, the following file element is created.
Image 5, Use XLink for file references is true
Also in this case the Content leaf is red, indicating that the Export property is set to false., The data of the node is available during execution, but it will not be exported to XML. A Query-element, with the same name as the original leaf, in this case Content, has been created, and twoattribute leaves have been added to this node.
- The href attribute leaf. This leaf contains the binary data, and a Save as file data processor has automatically been added to the leaf. Notice that the node has been added to the xlink namespace, see the property Prefix in image 5.
- The title attribute leaf.
Notice that the node has been added to the xlink namespace, see the property Prefix in image 5.