KeyView 24.4
KeyView Filter SDK .NET Programming Guide

# Metadata Examples

If you want to process both standardized and non-standardized metadata elements, you can iterate over metadata elements without checking an element's standard key – both standardized and non-standardized metadata can be handled in the same way. However, standardization provides a way to handle common types of metadata - using the same code for all file formats. Below is an illustrative example.

Copy

    // Open a document
    using (Document myDocument = session.Open(inputFilePath))
    using (Metadata metadata = myDocument.Metadata())
    {
        // Iterate over metadata fields
        foreach (MetadataElement element in metadata) using (element)
        {
            // Skip non-standardized fields
            if (element.StandardKey == MetadataKey.Other)
            {
                continue;
            }

            // Do something specific with the standardized Word Count field
            if (element.StandardKey == MetadataKey.WordCount)
            {
                // Do something with the word count
            }

            // General processing for all standard fields
        }
    }

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

Copy

    using (Metadata metadata = myDocument.Metadata())
    {
        // Iterate over metadata fields
        foreach (MetadataElement element in metadata) using (element)
        {
            // Process standardized elements where possible but also process
            // non-standard elements that have no standardized alternative.
            // Ignore duplicate elements output by KeyView for backwards compatibility.

            if (!element.HasStandardAlternative && !element.IsSuperseded)
            {
                // process element
            }
        }
    }

Copyright 1997-2024 Open Text
Version 24.4 | Last updated September 2024

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: IDOL KeyView 24.4

Topic Title: Metadata Examples