XmpPacketWrapper
Contents
[
Hide
]
XmpPacketWrapper class
Contains serialized XMP package including header and trailer. A wrapper consisting of a pair of XML processing instructions (PIs) may be placed around the rdf:RDF element.
public class XmpPacketWrapper : MetadataPackage, IXmpType
Constructors
Name | Description |
---|---|
XmpPacketWrapper() | Initializes a new instance of the XmpPacketWrapper class. |
XmpPacketWrapper(XmpHeaderPI, XmpTrailerPI, XmpMeta) | Initializes a new instance of the XmpPacketWrapper class. |
Properties
Name | Description |
---|---|
Count { get; } | Gets the number of metadata properties. |
HeaderPI { get; set; } | Gets or sets the header processing instruction. |
Item { get; } | Gets the MetadataProperty with the specified name. |
Keys { get; } | Gets a collection of the metadata property names. |
Meta { get; set; } | Gets or sets the XMP meta. |
MetadataType { get; } | Gets the metadata type. |
PackageCount { get; } | Gets the number of packages inside the XMP structure. |
Packages { get; } | Gets array of XmpPackage inside XMP. |
PropertyDescriptors { get; } | Gets a collection of descriptors that contain information about properties accessible through the GroupDocs.Metadata search engine. |
Schemes { get; } | Provides access to known XMP schemas. |
TrailerPI { get; set; } | Gets or sets the trailer processing instruction. |
Methods
Name | Description |
---|---|
AddPackage(XmpPackage) | Adds the package. |
virtual AddProperties(Func<MetadataProperty, bool>, PropertyValue) | Adds known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well. |
ClearPackages() | Removes all XmpPackage inside XMP. |
Contains(string) | Determines whether the package contains a metadata property with the specified name. |
ContainsPackage(string) | Determines whether package is exist in XMP wrapper. |
virtual FindProperties(Func<MetadataProperty, bool>) | Finds the metadata properties satisfying the specified predicate. The search is recursive so it affects all nested packages as well. |
GetEnumerator() | Returns an enumerator that iterates through the collection. |
GetPackage(string) | Gets package by namespace uri. |
GetXmpRepresentation() | Returns string contained value in XMP format. |
RemovePackage(XmpPackage) | Removes the specified package. |
virtual RemoveProperties(Func<MetadataProperty, bool>) | Removes metadata properties satisfying the specified predicate. |
virtual Sanitize() | Removes writable metadata properties from the package. The operation is recursive so it affects all nested packages as well. |
virtual SetProperties(Func<MetadataProperty, bool>, PropertyValue) | Sets known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well. This method is a combination of AddProperties and UpdateProperties . If an existing property satisfies the predicate its value is updated. If there is a known property missing in the package that satisfies the predicate it is added to the package. |
virtual UpdateProperties(Func<MetadataProperty, bool>, PropertyValue) | Updates known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well. |
Remarks
Learn more
Examples
This example shows how to update XMP metadata properties.
using (Metadata metadata = new Metadata(Constants.GifWithXmp))
{
IXmp root = metadata.GetRootPackage() as IXmp;
if (root != null && root.XmpPackage != null)
{
// if there is no such scheme in the XMP package we should create it
if (root.XmpPackage.Schemes.DublinCore == null)
{
root.XmpPackage.Schemes.DublinCore = new XmpDublinCorePackage();
}
root.XmpPackage.Schemes.DublinCore.Format = "image/gif";
root.XmpPackage.Schemes.DublinCore.SetRights("Copyright (C) 2011-2022 GroupDocs. All Rights Reserved");
root.XmpPackage.Schemes.DublinCore.SetSubject("test");
if (root.XmpPackage.Schemes.CameraRaw == null)
{
root.XmpPackage.Schemes.CameraRaw = new XmpCameraRawPackage();
}
root.XmpPackage.Schemes.CameraRaw.Shadows = 50;
root.XmpPackage.Schemes.CameraRaw.AutoBrightness = true;
root.XmpPackage.Schemes.CameraRaw.AutoExposure = true;
root.XmpPackage.Schemes.CameraRaw.CameraProfile = "test";
root.XmpPackage.Schemes.CameraRaw.Exposure = 0.0001;
// If you don't want to keep the old values just replace the whole scheme
root.XmpPackage.Schemes.XmpBasic = new XmpBasicPackage();
root.XmpPackage.Schemes.XmpBasic.CreateDate = DateTime.Today;
root.XmpPackage.Schemes.XmpBasic.BaseUrl = "https://groupdocs.com";
root.XmpPackage.Schemes.XmpBasic.Rating = 5;
root.XmpPackage.Schemes.BasicJobTicket = new XmpBasicJobTicketPackage();
// Set a complex type property
root.XmpPackage.Schemes.BasicJobTicket.Jobs = new[]
{
new XmpJob
{
ID = "1",
Name = "test job",
Url = "https://groupdocs.com"
},
};
// ...
metadata.Save(Constants.OutputGif);
}
}
See Also
- class MetadataPackage
- interface IXmpType
- namespace GroupDocs.Metadata.Standards.Xmp
- assembly GroupDocs.Metadata