34 September 2005 XMP Specification XMP Storage Model XMP Packet Wrapper 3 w means the packet can be updated in place, if there is enough space. The overall length of the packet must not be changed padding should be adjusted accordingly. The original encoding and byte order must be preserved, to avoid breaking text files containing XMP or violating other constraints of the original application. Scanning Files for XMP Packets This section explains how files can be scanned for XMP Packets, and why this should be done with caution. Caveats Knowledge of individual file formats provides the best way for an application to get access to XMP Packets. See Chapter 5, “Embedding XMP Metadata in Application Files” for detailed information on how XMP data is stored in specific file formats. Lacking this information, applications can find XMP Packets by scanning the file. However, this should be considered a last resort, especially if it is necessary to modify the data. Without knowledge of the file format, simply locating packets may not be sufficient. The following are some possible drawbacks: It may not be possible to determine which resource the XMP is associated with. If a JPEG image with XMP is placed in a page layout file of an application that is unaware of XMP, that file has one XMP Packet that refers to just the image, not the entire layout. When there is more than one XMP Packet in a file, it may be impossible to determine which is the “main” XMP, and what the overall resource containment hierarchy is in a compound document. Some packets could be obsolete. For example, PDF files allow incremental saves. Therefore, when changes are made to the document, there might be multiple packets, only one of which reflects the current state of the file. Scanning Hints A file should be scanned byte-by-byte until a valid header is found. First, the scanner should look for a byte pattern that represents the text ?xpacket begin= which will be one of the following byte patterns: 8-bit encoding (UTF-8): 0x3C 0x3F 0x78 0x70 0x61 0x63 0x6B 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6E 0x3D 16-bit encoding (UCS-2, UTF-16): (either big- or little-endian order) 0x3C 0x00 0x3F 0x00 0x78 0x00 0x70 0x00 0x61 0x00 0x63 0x00 0x6B 0x00 0x65 0x00 0x74 0x00 0x20 0x00 0x62 0x00 0x65 0x00 0x67 0x00 0x69 0x00 0x6E 0x00 0x3D [0x00]
Previous Page Next Page