File Content Extraction 25.1
Filter SDK C Programming Guide

# Metadata Examples

If you want to process both standardized and non-standardized metadata elements, you can loop through a KVMetadataList without checking the `eKey` member – both standardized and non-standardized metadata can be handled in the same way.

However, standardization allows you to handle particular metadata fields differently. Below are some illustrative examples of ways you might use standardized fields to act on documents.

    // Ignore non-standardized fields
    if(element->eKey == KVMetadataKey_Other)
    {
        continue;
    }

    // Ignore small images
    if(element->eKey == KVMetadataKey_ImageWidth)
    {
        int64_t width = *(int64_t*)element->pValue;
        if(width < 200)
        {
            break;
        }
    }

    // Search for documents created by a certain company
    if(element->eKey == KVMetadataKey_Company)
    {
        KV_String company = *(KV_String*)element->pValue;
        if(strncmp("OpenText", company.pcString, company.cbSize) == 0)
        {
            return pathToInputFile;
        }
    }

    // Find all documents created since the beginning of 2022
    if(element->eKey == KVMetadataKey_Created)
    {
        int64_t created = *(int64_t*)element->pValue;
        //2022-01-01 00:00:00 UTC in Windows File Time
        if(created > 132854688000000000)
        {
            return pathToInputFile;
        }
    }

## Handle Duplicate Metadata Elements

The following example demonstrates how to take advantage of field standardization, but also avoid processing a metadata field more than once.

    // Process standardized elements where possible but also process
    // non-standard elements that have no standardized alternative.
    // Ignore duplicate elements output for backwards compatibility.

    if(!element->bHasStandardAlternative && !element->bIsSuperseded)
    {
        process(element);
    }

Copyright 1997-2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: File Content Extraction 25.1

Topic Title: Metadata Examples