On this Page

    _metaData

    Access data file metadata

    Description

    DocOrigin can automatically embed certain additional metadata into data streams that it passes from one program to another. This data is automatically made available to the called routine. The metadata is placed at the very end of the data stream and looks something like this.

    The DocOrigin processing instruction actually occurs on a single line but is folded here for display purposes:

    <!--!#$%* DocOrigin - MetaData *%$#!-->
      <?DocOrigin _origFileName="C:\DocOrigin\DO\Samples\Sample_Invoice.xml"
      _source="CopyDataFile 3.1.001.08" _history="CopyDataFile 3.1.001.08"
      _submitTimeUtc="2016-09-11 20:25:08 UTC" _submitTimeLocal="2016-09-11 16:25:08"
      _userName="Dev_PC\Andy"?>
    <!--0000000309--> 

    You can see in the above, the meta-information that is provided. The 309 in the above example is the byte length of the metadata (it varies). This is used to help us select (and remove) the exact amount of introduced material from the data stream. Often job data files are small, one document, data streams but DocOrigin also processes very large, multi-document, data files. Being able to effect rapid access to information is critical.

    These metadata facilities are rarely used. They do involve processing overhead in order to hide or expose their existence as required by the process-of-the-moment. You should not use this feature unless you have a justifiable value proposition.

    How to get metadata - QueueMonitor

    The prime place where metadata is desired is when data is being funneled to DocOrigin via QueueMonitor, i.e. via a queue associated with a "virtual printer". It can be good to know when a file was submitted. Note that by the nature of spool queues, QueueMonitor is not provided with the original file name but rather receives simply a stream of bytes, so the metadata may not be as valuable as hoped. To get metadata delivered by QueueMonitor use the -metadata Y option in the applicable QueueMonitor port's PRM file (e.g. DocOriginQueueMonitor9100.prm for port 9100).

    How to get metadata - CopyDataFile

    (Windows only, also Linux as of 3.1.001.09) Another way to get metadata added to your data stream is to use the CopyDataFile program. By using the syntax

    DO CopyDataFile -metadata Y inputFile outputFile

    the output file will have the metadata appended. A standard operation is to have that output file actually refer to a QueueMonitor-managed virtual printer. Of course, if direct access is available, it may refer to a FolderMonitor watched folder. You may wish to experiment with this to see how the _history attribute gets expanded as the data stream goes through multiple metadata-aware processes. The -metadata Y command line options, if provided, must be provided as the first two arguments. If not provided, no metadata will be appended to the outputFile. It will be a simple direct copy operation.

    Getting metadata processed

    By default, Merge will not expect to have to handle metadata. It can be instructed to do so with the command line (or more likely PRM file) option:

    -metadata On

    Note that the setting value is On (not Y). If that setting exists then Merge will note the existence of any metadata and will construct the _metaData JavaScript object. That object will have the expected properties: _metaData._origFileName, _metaData._source, _metaData._history, ... i.e. all the attributes that you see in the sample above. Do note that the JavaScript object name is case sensitive and is _metaData, not _metadata.

    Metadata for non-XML

    Naturally, we expect that most data streams will be XML-based. However, this metadata, even though it is in XML format, can be appended to any data stream. It will be temporarily removed and re-added as necessary as the data flows through filters and whatnot.