org.apache.xmpbox

## Class XMPMetadata

- java.lang.Object
- - org.apache.xmpbox.XMPMetadata

    public class XMPMetadata
    extends Object

Object representation of XMPMetaData Be CAREFUL: typically, metadata should contain only one schema for each type (each NSURI). Retrieval of common schemas (like DublinCore) is based on this fact and take the first schema of this type encountered. However, XmpBox allow you to place schemas of same type with different prefix. If you do that, you must retrieve all schemas by yourself with getAllSchemas or with getSchema which use prefix parameter.

Author:
  a183132

### Constructor Summary

Constructors
`protected` `XMPMetadata()` Constructor of an empty default XMPMetaData.
`protected` `XMPMetadata(String xpacketBegin, String xpacketId, String xpacketBytes, String xpacketEncoding)` Creates blank XMP doc with specified parameters.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
`void` `addSchema(XMPSchema obj)` Add a schema to the current structure.
`void` `clearSchemas()` Removes all schemas defined.
`AdobePDFSchema` `createAndAddAdobePDFSchema()` Create and add an Adobe PDF schema to this metadata.
`XMPBasicJobTicketSchema` `createAndAddBasicJobTicketSchema()` Create and add a default Basic Job Ticket schema to this metadata.
`XMPSchema` `createAndAddDefaultSchema(String nsPrefix, String nsURI)` Create and add an unspecified schema.
`DublinCoreSchema` `createAndAddDublinCoreSchema()` Create and add a default Dublin Core schema to this metadata.
`XMPageTextSchema` `createAndAddPageTextSchema()` Create and add PageText Schema to this metadata.
`PDFAExtensionSchema` `createAndAddPDFAExtensionSchemaWithDefaultNS()` Create and add a default PDFA Extension schema to this metadata.
`PDFAExtensionSchema` `createAndAddPDFAExtensionSchemaWithNS(Map<String,String> namespaces)` Create and add a default PDFA Extension schema to this metadata.
`PDFAIdentificationSchema` `createAndAddPDFAIdentificationSchema()` Create and add a default PDFA Identification schema to this metadata.
`PDFAIdentificationSchema` `createAndAddPFAIdentificationSchema()` Deprecated. use `createAndAddPDFAIdentificationSchema()`
`PhotoshopSchema` `createAndAddPhotoshopSchema()` Create and add Photoshop Schema to this metadata.
`XMPBasicSchema` `createAndAddXMPBasicSchema()` Create and add a XMP Basic schema to this metadata.
`XMPMediaManagementSchema` `createAndAddXMPMediaManagementSchema()` Create and add a XMP Media Management schema to this metadata.
`XMPRightsManagementSchema` `createAndAddXMPRightsManagementSchema()` Create and add a default XMP Rights Management Schema to this metadata.
`static XMPMetadata` `createXMPMetadata()` Creates blank XMP doc with default parameters.
`static XMPMetadata` `createXMPMetadata(String xpacketBegin, String xpacketId, String xpacketBytes, String xpacketEncoding)` Creates blank XMP doc with specified parameters.
`AdobePDFSchema` `getAdobePDFSchema()` Get the Adobe PDF schema.
`List<XMPSchema>` `getAllSchemas()` Get All Schemas declared in this metadata representation.
`XMPBasicJobTicketSchema` `getBasicJobTicketSchema()` Get the Basic Job Ticket Schema.
`DublinCoreSchema` `getDublinCoreSchema()` Get the Dublin Core schema.
`String` `getEndXPacket()` get XPACKET END PI.
`XMPageTextSchema` `getPageTextSchema()` Get the PageText schema.
`PDFAIdentificationSchema` `getPDFAIdentificationSchema()` Get the PDFA Identification schema.
`PDFAExtensionSchema` `getPDFExtensionSchema()` Get the PDFA Extension schema.
`PDFAIdentificationSchema` `getPDFIdentificationSchema()` Deprecated. call `getPDFAIdentificationSchema()`
`PhotoshopSchema` `getPhotoshopSchema()` Get the Photoshop schema.
`XMPSchema` `getSchema(Class<? extends XMPSchema> clz)` Get the XMPSchema for the specified Class.
`XMPSchema` `getSchema(String nsURI)` Get the XMPSchema for the specified namespace.
`XMPSchema` `getSchema(String prefix, String nsURI)` Return the schema corresponding to this nsURI and a prefix.
`TypeMapping` `getTypeMapping()` Get TypeMapping.
`XMPBasicSchema` `getXMPBasicSchema()` Get the XMP Basic schema.
`XMPMediaManagementSchema` `getXMPMediaManagementSchema()` Get the XMP Media Management schema.
`XMPRightsManagementSchema` `getXMPRightsManagementSchema()` Get the XMP Rights Management Schema.
`String` `getXpacketBegin()` Get xpacket Begin.
`String` `getXpacketBytes()` Get xpacketBytes.
`String` `getXpacketEncoding()` Get xpacket encoding.
`String` `getXpacketId()` Get xpacket Id.
`void` `removeSchema(XMPSchema schema)` Remove a schema.
`void` `setEndXPacket(String data)` Set special XPACKET END PI.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### XMPMetadata

    protected XMPMetadata()

Constructor of an empty default XMPMetaData.

#### XMPMetadata

    protected XMPMetadata(String xpacketBegin,
                          String xpacketId,
                          String xpacketBytes,
                          String xpacketEncoding)

Creates blank XMP doc with specified parameters.

Parameters:
  `xpacketBegin` - Value of xpacketBegin
  `xpacketId` - Value of xpacketId
  `xpacketBytes` - Value of xpacketBytes
  `xpacketEncoding` - Value of xpacket encoding

### Method Detail

#### createXMPMetadata

    public static XMPMetadata createXMPMetadata()

Creates blank XMP doc with default parameters.

Returns:
  the XMPMetadata created.

#### createXMPMetadata

    public static XMPMetadata createXMPMetadata(String xpacketBegin,
                                                String xpacketId,
                                                String xpacketBytes,
                                                String xpacketEncoding)

Creates blank XMP doc with specified parameters.

Parameters:
  `xpacketBegin` - Value of xpacketBegin
  `xpacketId` - Value of xpacketId
  `xpacketBytes` - Value of xpacketBytes
  `xpacketEncoding` - Value of xpacket encoding
Returns:
  the XMPMetadata created.

#### getTypeMapping

    public TypeMapping getTypeMapping()

Get TypeMapping.

Returns:
  the defined TypeMapping.

#### getXpacketBytes

    public String getXpacketBytes()

Get xpacketBytes.

Returns:
  value of xpacketBytes field

#### getXpacketEncoding

    public String getXpacketEncoding()

Get xpacket encoding.

Returns:
  value of xpacket Encoding field

#### getXpacketBegin

    public String getXpacketBegin()

Get xpacket Begin.

Returns:
  value of xpacket Begin field

#### getXpacketId

    public String getXpacketId()

Get xpacket Id.

Returns:
  value of xpacket Id field

#### getAllSchemas

    public List<XMPSchema> getAllSchemas()

Get All Schemas declared in this metadata representation.

Returns:
  List of declared schemas

#### setEndXPacket

    public void setEndXPacket(String data)

Set special XPACKET END PI.

Parameters:
  `data` - The XPacket End value

#### getEndXPacket

    public String getEndXPacket()

get XPACKET END PI.

Returns:
  XPACKET END Value

#### getSchema

    public XMPSchema getSchema(String nsURI)

Get the XMPSchema for the specified namespace. Return the schema corresponding to this nsURI
BE CAREFUL: typically, Metadata should contain one schema for each type. This method returns the first schema encountered corresponding to this NSURI.
Return null if unknown

Parameters:
  `nsURI` - The namespace URI corresponding to the schema wanted
Returns:
  The matching XMP schema representation

#### getSchema

    public XMPSchema getSchema(Class<? extends XMPSchema> clz)

Get the XMPSchema for the specified Class. Return the schema corresponding to this Class
BE CAREFUL: typically, Metadata should contain one schema for each type. This method returns the first schema encountered corresponding to this Class.
Return null if unknown

Parameters:
  `clz` - The Class corresponding to the schema wanted
Returns:
  The matching XMP schema representation

#### getSchema

    public XMPSchema getSchema(String prefix,
                               String nsURI)

Return the schema corresponding to this nsURI and a prefix. This method is here to treat metadata which embed more than one time the same schema. It permits to retrieve a specific schema with its prefix

Parameters:
  `prefix` - The prefix fixed in the schema wanted
  `nsURI` - The namespace URI corresponding to the schema wanted
Returns:
  The Class Schema representation

#### createAndAddDefaultSchema

    public XMPSchema createAndAddDefaultSchema(String nsPrefix,
                                               String nsURI)

Create and add an unspecified schema.

Parameters:
  `nsPrefix` - The prefix wanted for the schema
  `nsURI` - The namespace URI wanted for the schema
Returns:
  The schema added in order to work on it

#### createAndAddPDFAExtensionSchemaWithDefaultNS

    public PDFAExtensionSchema createAndAddPDFAExtensionSchemaWithDefaultNS()

Create and add a default PDFA Extension schema to this metadata. This method return the created schema to enter information. This PDFAExtension is created with all default namespaces used in PDFAExtensionSchema.

Returns:
  PDFAExtension schema added in order to work on it

#### createAndAddPDFAExtensionSchemaWithNS

    public PDFAExtensionSchema createAndAddPDFAExtensionSchemaWithNS(Map<String,String> namespaces)
                                                              throws XmpSchemaException

Create and add a default PDFA Extension schema to this metadata. This method return the created schema to enter information. This PDFAExtension is created with specified list of namespaces.

Parameters:
  `namespaces` - Special namespaces list to use
Returns:
  schema added in order to work on it
Throws:
  `XmpSchemaException` - If namespaces list not contains PDF/A Extension namespace URI

#### getPDFExtensionSchema

    public PDFAExtensionSchema getPDFExtensionSchema()

Get the PDFA Extension schema. This method return null if not found.

Returns:
  The PDFAExtension schema or null if not declared

#### createAndAddPFAIdentificationSchema

    @Deprecated
    public PDFAIdentificationSchema createAndAddPFAIdentificationSchema()

Deprecated. use `createAndAddPDFAIdentificationSchema()`
Create and add a default PDFA Identification schema to this metadata. This method return the created schema to enter information.

Returns:
  schema added in order to work on it

#### createAndAddPDFAIdentificationSchema

    public PDFAIdentificationSchema createAndAddPDFAIdentificationSchema()

Create and add a default PDFA Identification schema to this metadata. This method return the created schema to enter information.

Returns:
  schema added in order to work on it

#### getPDFIdentificationSchema

    @Deprecated
    public PDFAIdentificationSchema getPDFIdentificationSchema()

Deprecated. call `getPDFAIdentificationSchema()`
Get the PDFA Identification schema. This method return null if not found.

Returns:
  The PDFAIdentificationSchema schema or null if not declared

#### getPDFAIdentificationSchema

    public PDFAIdentificationSchema getPDFAIdentificationSchema()

Get the PDFA Identification schema. This method return null if not found.

Returns:
  The PDFAIdentificationSchema schema or null if not declared

#### createAndAddDublinCoreSchema

    public DublinCoreSchema createAndAddDublinCoreSchema()

Create and add a default Dublin Core schema to this metadata. This method return the created schema to enter information

Returns:
  schema added in order to work on it

#### getDublinCoreSchema

    public DublinCoreSchema getDublinCoreSchema()

Get the Dublin Core schema. This method return null if not found

Returns:
  The DublinCoreSchema schema or null if not declared.

#### createAndAddBasicJobTicketSchema

    public XMPBasicJobTicketSchema createAndAddBasicJobTicketSchema()

Create and add a default Basic Job Ticket schema to this metadata. This method return the created schema to enter information.

Returns:
  schema added in order to work on it.

#### getBasicJobTicketSchema

    public XMPBasicJobTicketSchema getBasicJobTicketSchema()

Get the Basic Job Ticket Schema. This method return null if not found

Returns:
  The XMPBasicJobTicketSchema schema or null if not declared.

#### createAndAddXMPRightsManagementSchema

    public XMPRightsManagementSchema createAndAddXMPRightsManagementSchema()

Create and add a default XMP Rights Management Schema to this metadata. This method return the created schema to enter information.

Returns:
  schema added in order to work on it

#### getXMPRightsManagementSchema

    public XMPRightsManagementSchema getXMPRightsManagementSchema()

Get the XMP Rights Management Schema. This method return null if not found.

Returns:
  The XMPRightsManagementSchema schema or null if not declared

#### createAndAddXMPBasicSchema

    public XMPBasicSchema createAndAddXMPBasicSchema()

Create and add a XMP Basic schema to this metadata. This method return the created schema to enter information

Returns:
  schema added in order to work on it

#### getXMPBasicSchema

    public XMPBasicSchema getXMPBasicSchema()

Get the XMP Basic schema. This method return null if not found

Returns:
  The XMPBasicSchema schema or null if not declared

#### createAndAddXMPMediaManagementSchema

    public XMPMediaManagementSchema createAndAddXMPMediaManagementSchema()

Create and add a XMP Media Management schema to this metadata. This method return the created schema to enter information

Returns:
  schema added in order to work on it

#### createAndAddPhotoshopSchema

    public PhotoshopSchema createAndAddPhotoshopSchema()

Create and add Photoshop Schema to this metadata. This method return the created schema to enter information

Returns:
  schema added in order to work on it

#### getPhotoshopSchema

    public PhotoshopSchema getPhotoshopSchema()

Get the Photoshop schema. This method return null if not found

Returns:
  The PhotoshopSchema schema or null if not declared

#### getXMPMediaManagementSchema

    public XMPMediaManagementSchema getXMPMediaManagementSchema()

Get the XMP Media Management schema. This method return null if not found

Returns:
  The XMPMediaManagementSchema schema or null if not declared

#### createAndAddAdobePDFSchema

    public AdobePDFSchema createAndAddAdobePDFSchema()

Create and add an Adobe PDF schema to this metadata. This method return the created schema to enter information

Returns:
  schema added in order to work on it

#### getAdobePDFSchema

    public AdobePDFSchema getAdobePDFSchema()

Get the Adobe PDF schema. This method return null if not found

Returns:
  The AdobePDFSchema schema or null if not declared

#### addSchema

    public void addSchema(XMPSchema obj)

Add a schema to the current structure.

Parameters:
  `obj` - the schema to add

#### removeSchema

    public void removeSchema(XMPSchema schema)

Remove a schema.

Parameters:
  `schema` - The schema to remove

#### clearSchemas

    public void clearSchemas()

Removes all schemas defined.

#### createAndAddPageTextSchema

    public XMPageTextSchema createAndAddPageTextSchema()

Create and add PageText Schema to this metadata. This method return the created schema to enter information

Returns:
  schema added in order to work on it

#### getPageTextSchema

    public XMPageTextSchema getPageTextSchema()

Get the PageText schema. This method return null if not found

Returns:
  The PageTextSchema schema or null if not declared