org.apache.jempbox.xmp
public class XMPMetadata extends Object
Version: $Revision: 1.10 $
Field Summary | |
---|---|
protected String | encoding
The encoding of the XMP document. |
static String | ENCODING_UTF16BE
Supported encoding for persisted XML. |
static String | ENCODING_UTF16LE
Supported encoding for persisted XML. |
static String | ENCODING_UTF8
Supported encoding for persisted XML. |
protected Map<String,Class<?>> | nsMappings
A mapping of namespaces. |
protected Document | xmpDocument
The DOM representation of the metadata. |
Constructor Summary | |
---|---|
XMPMetadata()
Default constructor, creates blank XMP doc.
| |
XMPMetadata(Document doc)
Constructor from an existing XML document.
|
Method Summary | |
---|---|
XMPSchemaBasicJobTicket | addBasicJobTicketSchema()
Add a new Job Ticket schema.
|
XMPSchemaBasic | addBasicSchema()
Create and add a new Basic Schema to this metadata. |
XMPSchemaDublinCore | addDublinCoreSchema()
Create and add a new Dublin Core Schema to this metadata. |
XMPSchemaDynamicMedia | addDynamicMediaSchema()
Add a new Dynamic Media schema.
|
XMPSchemaIptc4xmpCore | addIptc4xmpCoreSchema()
Create and add a new IPTC schema to this metadata.
|
XMPSchemaMediaManagement | addMediaManagementSchema()
Add a new Media Management schema.
|
XMPSchemaPagedText | addPagedTextSchema()
Add a new Paged Text schema.
|
XMPSchemaPDF | addPDFSchema()
Create and add a new PDF Schema to this metadata. |
XMPSchemaPhotoshop | addPhotoshopSchema()
Create and add a new Photoshop schema to this metadata.
|
XMPSchemaRightsManagement | addRightsManagementSchema()
Add a new Rights Managment schema.
|
void | addSchema(XMPSchema schema)
Add a custom schema to the root rdf. |
void | addXMLNSMapping(String namespace, Class<?> xmpSchema)
Will add a XMPSchema to the set of identified schemas.
|
byte[] | asByteArray()
Get the XML document as a byte array.
|
protected XMPSchema | basicAddSchema(XMPSchema schema)
Generic add schema method.
|
XMPSchemaBasicJobTicket | getBasicJobTicketSchema()
Get the Job Ticket Schema.
|
XMPSchemaBasic | getBasicSchema()
Get the Basic Schema.
|
XMPSchemaDublinCore | getDublinCoreSchema()
Get the Dublin Core Schema.
|
XMPSchemaDynamicMedia | getDynamicMediaSchema()
Get the Dynamic Media Schema.
|
String | getEncoding()
Get the current encoding that will be used to write the XML.
|
XMPSchemaMediaManagement | getMediaManagementSchema()
Get the Media Management Schema.
|
XMPSchemaPagedText | getPagedTextSchema()
Get the Paged Text Schema.
|
XMPSchemaPDF | getPDFSchema()
Get the PDF Schema.
|
XMPSchemaRightsManagement | getRightsManagementSchema()
Get the Schema Rights Schema.
|
XMPSchema | getSchemaByClass(Class<?> targetSchema)
Tries to retrieve a schema from this by classname.
|
List<XMPSchema> | getSchemas()
This will get a list of XMPSchema(or subclass) objects.
|
List<XMPSchema> | getSchemasByNamespaceURI(String namespaceURI)
Will return all schemas that fit the given namespaceURI. |
Document | getXMPDocument()
Get the XML document from this object.
|
boolean | hasUnknownSchema()
This will return true if the XMP contains an unknown schema.
|
static XMPMetadata | load(String file)
Load metadata from the filesystem.
|
static XMPMetadata | load(InputSource is)
Load a schema from an input source.
|
static XMPMetadata | load(InputStream is)
Load metadata from the filesystem.
|
static void | main(String[] args)
Test main program.
|
void | merge(XMPMetadata metadata)
Merge this metadata with the given metadata object.
|
void | save(String file)
Save the XMP document to a file.
|
void | save(OutputStream outStream)
Save the XMP document to a stream.
|
void | setEncoding(String xmlEncoding)
The encoding used to write the XML. |
Throws: IOException If there is an error creating the initial document.
Parameters: doc The root XMP document.
Returns: The newly added schema.
Returns: A new blank PDF schema that is now part of the metadata.
Returns: A new blank PDF schema that is now part of the metadata.
Returns: The newly added schema.
Returns: A new blank IPTC schema that is now part of the metadata.
Returns: The newly added schema.
Returns: The newly added schema.
Returns: A new blank PDF schema that is now part of the metadata.
Returns: A new blank Photoshop schema that is now part of the metadata.
Returns: The newly added schema.
Parameters: schema The schema to add.
Parameters: namespace The namespace URI of the schmema for instance http://purl.org/dc/elements/1.1/. xmpSchema The schema to associated this identifier with.
Returns: The metadata as an XML byte stream.
Throws: Exception If there is an error creating the stream.
Parameters: schema The schema to add.
Returns: The newly added schema.
Returns: The first Job Ticket schema in the list.
Throws: IOException If there is an error accessing the schema.
Returns: The first Basic schema in the list.
Throws: IOException If there is an error accessing the schema.
Returns: The first Dublin schema in the list.
Throws: IOException If there is an error accessing the schema.
Returns: The first Dynamic Media schema in the list.
Throws: IOException If there is an error accessing the schema.
Returns: The current encoding to write the XML to.
Returns: The first Media Management schema in the list.
Throws: IOException If there is an error accessing the schema.
Returns: The first Paged Text schema in the list.
Throws: IOException If there is an error accessing the schema.
Returns: The first PDF schema in the list.
Throws: IOException If there is an error accessing the schema.
Returns: The first Schema Rights schema in the list.
Throws: IOException If there is an error accessing the schema.
Parameters: targetSchema Class for targetSchema.
Returns: XMPSchema or null if no target is found.
Throws: IOException if there was an error creating the schemas of this.
Returns: A non null read-only list of schemas that are part of this metadata.
Throws: IOException If there is an error creating a specific schema.
Parameters: namespaceURI The namespaceURI to filter for.
Returns: A list containing the found schemas or an empty list if non are found or the namespaceURI could not be found in the namespace mapping.
Throws: IOException If an operation on the document fails.
Returns: This object as an XML document.
Returns: True if an unknown schema is found, false otherwise
Throws: IOException If there is an error
Parameters: file The file to load the metadata from.
Returns: The loaded XMP document.
Throws: IOException If there is an error reading the data.
Parameters: is The input source to load the schema from.
Returns: The loaded/parsed schema.
Throws: IOException If there was an error while loading the schema.
Parameters: is The stream to load the data from.
Returns: The loaded XMP document.
Throws: IOException If there is an error reading the data.
Parameters: args The command line arguments.
Throws: Exception If there is an error.
Parameters: metadata The metadata to merge with this document.
Throws: IOException If there is an error merging the data.
Parameters: file The file to save the XMP document to.
Throws: Exception If there is an error while writing to the stream.
Parameters: outStream The stream to save the XMP document to.
Throws: TransformerException If there is an error while writing to the stream.
Parameters: xmlEncoding The encoding to write the XML as.