XmpPacket Class

Definition

An XMP packet: the properties of one rdf:RDF element, with typed getters for the properties PDF files commonly use.

public sealed class XmpPacket

Remarks

ISO 16684-1 §7. A packet is one rdf:RDF element, optionally inside an x:xmpmeta element and an <?xpacket?> wrapper (§7.3), neither required. Its rdf:Description elements all describe the same resource and their properties are merged; a property written twice keeps its first value. Properties are identified by namespace name and local name (see XmpNamespaces), never by prefix. Every form §7.5-7.9 allows is read: simple values as elements or as attributes, structures as nested descriptions, rdf:parseType="Resource" or attributes, arrays as rdf:Bag, rdf:Seq and rdf:Alt, and qualifiers written with rdf:value.

Reading (TryParse(ReadOnlySpan<Byte>, out XmpPacket?)): a leading byte order mark selects UTF-8, UTF-16 or UTF-32 (§7.1; without one, UTF-16 is recognized by the first character and anything else is read as UTF-8); bytes before the first < are skipped; reading stops at the end of the rdf:RDF element, so the packet padding and whatever follows it are never read. The XML is read with document type declarations refused (no entity is ever expanded and nothing outside the packet is fetched) and at most 16 million characters. Malformed XML before the end of rdf:RDF makes the whole packet unreadable.

Immutable: a snapshot of the bytes it was read from. The document's own packet is written through Properties, which keeps every property and rewrites the packet in canonical form.

Tip: use kind:method, kind:property, kind:ctor. Press Esc to clear.

Properties (21)

Methods (4)