Metadata Examples
If you want to process both standardized and non-standardized metadata fields, 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.
# Open a document
doc = session.open(file_path)
# Iterate over metadata fields
for element in doc.metadata:
# Skip non-standard fields
if element.standard_key == kv.MetadataKey.Other:
continue
# Do something with the standardized WordCount field
if element.standard_key == kv.MetadataKey.WordCount:
print(f"The word count is {element.value}")