Class XMPMetaImpl
- java.lang.Object
-
- com.itextpdf.xmp.impl.XMPMetaImpl
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
packetHeader
the xpacket processing instructions contentprivate XMPNode
tree
root of the metadata treeprivate static int
VALUE_BASE64
private static int
VALUE_BOOLEAN
private static int
VALUE_CALENDAR
private static int
VALUE_DATE
private static int
VALUE_DOUBLE
private static int
VALUE_INTEGER
private static int
VALUE_LONG
private static int
VALUE_STRING
Property values are Strings by default-
Fields inherited from interface com.itextpdf.xmp.XMPConst
ARRAY_ITEM_NAME, ARRAY_LAST_ITEM, FALSESTR, NS_ADOBESTOCKPHOTO, NS_ASF, NS_BWF, NS_CAMERARAW, NS_CREATOR_ATOM, NS_DC, NS_DC_DEPRECATED, NS_DICOM, NS_DM, NS_EXIF, NS_EXIF_AUX, NS_EXIFX, NS_IPTCCORE, NS_IPTCEXT, NS_IX, NS_JP2K, NS_JPEG, NS_PDF, NS_PDFA_EXTENSION, NS_PDFA_FIELD, NS_PDFA_ID, NS_PDFA_PROPERTY, NS_PDFA_SCHEMA, NS_PDFA_TYPE, NS_PDFUA_ID, NS_PDFX, NS_PDFX_ID, NS_PHOTOSHOP, NS_PLUS, NS_PNG, NS_PSALBUM, NS_RDF, NS_RIFFINFO, NS_SCRIPT, NS_SWF, NS_TIFF, NS_TRANSIENT, NS_TXMP, NS_WAV, NS_X, NS_XML, NS_XMP, NS_XMP_BJ, NS_XMP_MM, NS_XMP_NOTE, NS_XMP_RIGHTS, RDF_TYPE, TAG_XAPMETA, TAG_XMPMETA, TRUESTR, TYPE_DIMENSIONS, TYPE_FONT, TYPE_GRAPHICS, TYPE_IDENTIFIERQUAL, TYPE_IMAGE, TYPE_MANIFESTITEM, TYPE_PAGEDFILE, TYPE_RESOURCEEVENT, TYPE_RESOURCEREF, TYPE_ST_JOB, TYPE_ST_VERSION, TYPE_TEXT, X_DEFAULT, XML_LANG, XMP_PI
-
-
Constructor Summary
Constructors Constructor Description XMPMetaImpl()
Constructor for an empty metadata object.XMPMetaImpl(XMPNode tree)
Constructor for a cloned metadata tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendArrayItem(java.lang.String schemaNS, java.lang.String arrayName, PropertyOptions arrayOptions, java.lang.String itemValue, PropertyOptions itemOptions)
Simplifies the construction of an array by not requiring that you pre-create an empty array.void
appendArrayItem(java.lang.String schemaNS, java.lang.String arrayName, java.lang.String itemValue)
java.lang.Object
clone()
Performs a deep clone of the XMPMeta-objectint
countArrayItems(java.lang.String schemaNS, java.lang.String arrayName)
Returns the number of items in the array.void
deleteArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex)
Deletes the given XMP subtree rooted at the given array item.void
deleteProperty(java.lang.String schemaNS, java.lang.String propName)
Deletes the given XMP subtree rooted at the given property.void
deleteQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName)
Deletes the given XMP subtree rooted at the given qualifier.void
deleteStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName)
Deletes the given XMP subtree rooted at the given struct field.boolean
doesArrayItemExist(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex)
Tells if the array item exists.boolean
doesPropertyExist(java.lang.String schemaNS, java.lang.String propName)
Returns whether the property exists.boolean
doesQualifierExist(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName)
DoesQualifierExist tells if the qualifier exists.boolean
doesStructFieldExist(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName)
DoesStructFieldExist tells if the struct field exists.private void
doSetArrayItem(XMPNode arrayNode, int itemIndex, java.lang.String itemValue, PropertyOptions itemOptions, boolean insert)
Locate or create the item node and set the value.java.lang.String
dumpObject()
Renders this node and the tree unter this node in a human readable form.private java.lang.Object
evaluateNodeValue(int valueType, XMPNode propNode)
Evaluates a raw node value to the given value type, apply special conversions for defined types in XMP.XMPProperty
getArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex)
Provides access to items within an array.XMPProperty
getLocalizedText(java.lang.String schemaNS, java.lang.String altTextName, java.lang.String genericLang, java.lang.String specificLang)
These functions provide convenient support for localized text properties, including a number of special and obscure aspects.java.lang.String
getObjectName()
This correlates to the about-attribute, returns the empty String if no name is set.java.lang.String
getPacketHeader()
XMPProperty
getProperty(java.lang.String schemaNS, java.lang.String propName)
The property value getter-methods all take a property specification: the first two parameters are always the top level namespace URI (the "schema" namespace) and the basic name of the property being referenced.protected XMPProperty
getProperty(java.lang.String schemaNS, java.lang.String propName, int valueType)
Returns a property, but the result value can be requested.byte[]
getPropertyBase64(java.lang.String schemaNS, java.lang.String propName)
Convenience method to retrieve the literal value of a property.java.lang.Boolean
getPropertyBoolean(java.lang.String schemaNS, java.lang.String propName)
These are very similar togetProperty()
andSetProperty()
above, but the value is returned or provided in a literal form instead of as a UTF-8 string.java.util.Calendar
getPropertyCalendar(java.lang.String schemaNS, java.lang.String propName)
Convenience method to retrieve the literal value of a property.XMPDateTime
getPropertyDate(java.lang.String schemaNS, java.lang.String propName)
Convenience method to retrieve the literal value of a property.java.lang.Double
getPropertyDouble(java.lang.String schemaNS, java.lang.String propName)
Convenience method to retrieve the literal value of a property.java.lang.Integer
getPropertyInteger(java.lang.String schemaNS, java.lang.String propName)
Convenience method to retrieve the literal value of a property.java.lang.Long
getPropertyLong(java.lang.String schemaNS, java.lang.String propName)
Convenience method to retrieve the literal value of a property.protected java.lang.Object
getPropertyObject(java.lang.String schemaNS, java.lang.String propName, int valueType)
Returns a property, but the result value can be requested.java.lang.String
getPropertyString(java.lang.String schemaNS, java.lang.String propName)
Convenience method to retrieve the literal value of a property.XMPProperty
getQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName)
Provides access to a qualifier attached to a property.XMPNode
getRoot()
XMPProperty
getStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName)
Provides access to fields within a nested structure.void
insertArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue)
void
insertArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue, PropertyOptions options)
Inserts an item into an array previous to the given index.XMPIterator
iterator()
Constructs an iterator for the properties within this XMP object.XMPIterator
iterator(IteratorOptions options)
Constructs an iterator for the properties within this XMP object using some options.XMPIterator
iterator(java.lang.String schemaNS, java.lang.String propName, IteratorOptions options)
Construct an iterator for the properties within an XMP object.void
normalize(ParseOptions options)
Perform the normalization as a separate parsing step.void
setArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue)
void
setArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue, PropertyOptions options)
Replaces an item within an array.void
setLocalizedText(java.lang.String schemaNS, java.lang.String altTextName, java.lang.String genericLang, java.lang.String specificLang, java.lang.String itemValue)
void
setLocalizedText(java.lang.String schemaNS, java.lang.String altTextName, java.lang.String genericLang, java.lang.String specificLang, java.lang.String itemValue, PropertyOptions options)
Modifies the value of a selected item in an alt-text array.(package private) void
setNode(XMPNode node, java.lang.Object value, PropertyOptions newOptions, boolean deleteExisting)
The internals for setProperty() and related calls, used after the node is found or created.void
setObjectName(java.lang.String name)
void
setPacketHeader(java.lang.String packetHeader)
Sets the packetHeader attributes, only used by the parser.void
setProperty(java.lang.String schemaNS, java.lang.String propName, java.lang.Object propValue)
void
setProperty(java.lang.String schemaNS, java.lang.String propName, java.lang.Object propValue, PropertyOptions options)
The property valuesetters
all take a property specification, their differences are in the form of this.void
setPropertyBase64(java.lang.String schemaNS, java.lang.String propName, byte[] propValue)
void
setPropertyBase64(java.lang.String schemaNS, java.lang.String propName, byte[] propValue, PropertyOptions options)
Convenience method to set a property from a binarybyte[]
-array, which is serialized as base64-string.void
setPropertyBoolean(java.lang.String schemaNS, java.lang.String propName, boolean propValue)
void
setPropertyBoolean(java.lang.String schemaNS, java.lang.String propName, boolean propValue, PropertyOptions options)
Convenience method to set a property to a literalboolean
value.void
setPropertyCalendar(java.lang.String schemaNS, java.lang.String propName, java.util.Calendar propValue)
void
setPropertyCalendar(java.lang.String schemaNS, java.lang.String propName, java.util.Calendar propValue, PropertyOptions options)
Convenience method to set a property with a Java Calendar-object, which is serialized to an ISO8601 date.void
setPropertyDate(java.lang.String schemaNS, java.lang.String propName, XMPDateTime propValue)
void
setPropertyDate(java.lang.String schemaNS, java.lang.String propName, XMPDateTime propValue, PropertyOptions options)
Convenience method to set a property with an XMPDateTime-object, which is serialized to an ISO8601 date.void
setPropertyDouble(java.lang.String schemaNS, java.lang.String propName, double propValue)
void
setPropertyDouble(java.lang.String schemaNS, java.lang.String propName, double propValue, PropertyOptions options)
Convenience method to set a property to a literaldouble
value.void
setPropertyInteger(java.lang.String schemaNS, java.lang.String propName, int propValue)
void
setPropertyInteger(java.lang.String schemaNS, java.lang.String propName, int propValue, PropertyOptions options)
Convenience method to set a property to a literalint
value.void
setPropertyLong(java.lang.String schemaNS, java.lang.String propName, long propValue)
void
setPropertyLong(java.lang.String schemaNS, java.lang.String propName, long propValue, PropertyOptions options)
Convenience method to set a property to a literallong
value.void
setQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName, java.lang.String qualValue)
void
setQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName, java.lang.String qualValue, PropertyOptions options)
Provides access to a qualifier attached to a property.void
setStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName, java.lang.String fieldValue)
void
setStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName, java.lang.String fieldValue, PropertyOptions options)
Provides access to fields within a nested structure.void
sort()
Sorts the complete datamodel according to the following rules: Schema nodes are sorted by prefix.
-
-
-
Field Detail
-
VALUE_STRING
private static final int VALUE_STRING
Property values are Strings by default- See Also:
- Constant Field Values
-
VALUE_BOOLEAN
private static final int VALUE_BOOLEAN
- See Also:
- Constant Field Values
-
VALUE_INTEGER
private static final int VALUE_INTEGER
- See Also:
- Constant Field Values
-
VALUE_LONG
private static final int VALUE_LONG
- See Also:
- Constant Field Values
-
VALUE_DOUBLE
private static final int VALUE_DOUBLE
- See Also:
- Constant Field Values
-
VALUE_DATE
private static final int VALUE_DATE
- See Also:
- Constant Field Values
-
VALUE_CALENDAR
private static final int VALUE_CALENDAR
- See Also:
- Constant Field Values
-
VALUE_BASE64
private static final int VALUE_BASE64
- See Also:
- Constant Field Values
-
tree
private XMPNode tree
root of the metadata tree
-
packetHeader
private java.lang.String packetHeader
the xpacket processing instructions content
-
-
Constructor Detail
-
XMPMetaImpl
public XMPMetaImpl()
Constructor for an empty metadata object.
-
XMPMetaImpl
public XMPMetaImpl(XMPNode tree)
Constructor for a cloned metadata tree.- Parameters:
tree
- an prefilled metadata tree which fulfills allXMPNode
contracts.
-
-
Method Detail
-
appendArrayItem
public void appendArrayItem(java.lang.String schemaNS, java.lang.String arrayName, PropertyOptions arrayOptions, java.lang.String itemValue, PropertyOptions itemOptions) throws XMPException
Description copied from interface:XMPMeta
Simplifies the construction of an array by not requiring that you pre-create an empty array. The array that is assigned is created automatically if it does not yet exist. Each call to appendArrayItem() appends an item to the array. The corresponding parameters have the same use as setArrayItem(). The arrayOptions parameter is used to specify what kind of array. If the array exists, it must have the specified form.- Specified by:
appendArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the array. Has the same usage as in getProperty.arrayName
- The name of the array. May be a general path expression, must not be null or the empty string. Has the same namespace prefix usage as propPath in getProperty.arrayOptions
- Option flags describing the array form. The only valid options are-
PropertyOptions.ARRAY
, -
PropertyOptions.ARRAY_ORDERED
, -
PropertyOptions.ARRAY_ALTERNATE
or -
PropertyOptions.ARRAY_ALT_TEXT
.
null
or useXMPMeta.appendArrayItem(String, String, String)
.-
itemValue
- the value of the array item. Has the same usage as propValue in getProperty.itemOptions
- Option flags describing the item to append (PropertyOptions
)- Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.appendArrayItem(String, String, PropertyOptions, String, PropertyOptions)
-
appendArrayItem
public void appendArrayItem(java.lang.String schemaNS, java.lang.String arrayName, java.lang.String itemValue) throws XMPException
- Specified by:
appendArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the arrayarrayName
- The name of the arrayitemValue
- the value of the array item- Throws:
XMPException
- Wraps all errors and exceptions- See Also:
XMPMeta.appendArrayItem(String, String, String)
-
countArrayItems
public int countArrayItems(java.lang.String schemaNS, java.lang.String arrayName) throws XMPException
Description copied from interface:XMPMeta
Returns the number of items in the array.- Specified by:
countArrayItems
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the array. Has the same usage as in getProperty.arrayName
- The name of the array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.- Returns:
- Returns the number of items in the array.
- Throws:
XMPException
- See Also:
XMPMeta.countArrayItems(String, String)
-
deleteArrayItem
public void deleteArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex)
Description copied from interface:XMPMeta
Deletes the given XMP subtree rooted at the given array item. It is not an error if the array item does not exist.- Specified by:
deleteArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the array. Has the same usage as in getProperty.arrayName
- The name of the array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.itemIndex
- The index of the desired item. Arrays in XMP are indexed from 1. The constantXMPConst.ARRAY_LAST_ITEM
always refers to the last existing array item.- See Also:
XMPMeta.deleteArrayItem(String, String, int)
-
deleteProperty
public void deleteProperty(java.lang.String schemaNS, java.lang.String propName)
Description copied from interface:XMPMeta
Deletes the given XMP subtree rooted at the given property. It is not an error if the property does not exist.- Specified by:
deleteProperty
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as in getProperty.- See Also:
XMPMeta.deleteProperty(String, String)
-
deleteQualifier
public void deleteQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName)
Description copied from interface:XMPMeta
Deletes the given XMP subtree rooted at the given qualifier. It is not an error if the qualifier does not exist.- Specified by:
deleteQualifier
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as ingetProperty()
.propName
- The name of the property to which the qualifier is attached. Has the same usage as in getProperty.qualNS
- The namespace URI for the qualifier. Has the same URI and prefix usage as the schemaNS parameter.qualName
- The name of the qualifier. Must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the propName parameter.- See Also:
XMPMeta.deleteQualifier(String, String, String, String)
-
deleteStructField
public void deleteStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName)
Description copied from interface:XMPMeta
Deletes the given XMP subtree rooted at the given struct field. It is not an error if the field does not exist.- Specified by:
deleteStructField
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as ingetProperty()
.structName
- The name of the struct. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName in getProperty.fieldNS
- The namespace URI for the field. Has the same URI and prefix usage as the schemaNS parameter.fieldName
- The name of the field. Must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the structName parameter.- See Also:
XMPMeta.deleteStructField(String, String, String, String)
-
doesPropertyExist
public boolean doesPropertyExist(java.lang.String schemaNS, java.lang.String propName)
Description copied from interface:XMPMeta
Returns whether the property exists.- Specified by:
doesPropertyExist
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns true if the property exists.
- See Also:
XMPMeta.doesPropertyExist(String, String)
-
doesArrayItemExist
public boolean doesArrayItemExist(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex)
Description copied from interface:XMPMeta
Tells if the array item exists.- Specified by:
doesArrayItemExist
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the array. Has the same usage as ingetProperty()
.arrayName
- The name of the array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.itemIndex
- The index of the desired item. Arrays in XMP are indexed from 1. The constantXMPConst.ARRAY_LAST_ITEM
always refers to the last existing array item.- Returns:
- Returns
true
if the array exists,false
otherwise. - See Also:
XMPMeta.doesArrayItemExist(String, String, int)
-
doesStructFieldExist
public boolean doesStructFieldExist(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName)
Description copied from interface:XMPMeta
DoesStructFieldExist tells if the struct field exists.- Specified by:
doesStructFieldExist
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as ingetProperty()
.structName
- The name of the struct. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.fieldNS
- The namespace URI for the field. Has the same URI and prefix usage as the schemaNS parameter.fieldName
- The name of the field. Must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the structName parameter.- Returns:
- Returns true if the field exists.
- See Also:
XMPMeta.doesStructFieldExist(String, String, String, String)
-
doesQualifierExist
public boolean doesQualifierExist(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName)
Description copied from interface:XMPMeta
DoesQualifierExist tells if the qualifier exists.- Specified by:
doesQualifierExist
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as ingetProperty()
.propName
- The name of the property to which the qualifier is attached. Has the same usage as ingetProperty()
.qualNS
- The namespace URI for the qualifier. Has the same URI and prefix usage as the schemaNS parameter.qualName
- The name of the qualifier. Must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the propName parameter.- Returns:
- Returns true if the qualifier exists.
- See Also:
XMPMeta.doesQualifierExist(String, String, String, String)
-
getArrayItem
public XMPProperty getArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex) throws XMPException
Description copied from interface:XMPMeta
Provides access to items within an array. The index is passed as an integer, you need not worry about the path string syntax for array items, convert a loop index to a string, etc.- Specified by:
getArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the array. Has the same usage as in getProperty.arrayName
- The name of the array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.itemIndex
- The index of the desired item. Arrays in XMP are indexed from 1. The constantXMPConst.ARRAY_LAST_ITEM
always refers to the last existing array item.- Returns:
- Returns a
XMPProperty
containing the value and the options ornull
if the property does not exist. - Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.getArrayItem(String, String, int)
-
getLocalizedText
public XMPProperty getLocalizedText(java.lang.String schemaNS, java.lang.String altTextName, java.lang.String genericLang, java.lang.String specificLang) throws XMPException
Description copied from interface:XMPMeta
These functions provide convenient support for localized text properties, including a number of special and obscure aspects. Localized text properties are stored in alt-text arrays. They allow multiple concurrent localizations of a property value, for example a document title or copyright in several languages. The most important aspect of these functions is that they select an appropriate array item based on one or two RFC 3066 language tags. One of these languages, the "specific" language, is preferred and selected if there is an exact match. For many languages it is also possible to define a "generic" language that may be used if there is no specific language match. The generic language must be a valid RFC 3066 primary subtag, or the empty string. For example, a specific language of "en-US" should be used in the US, and a specific language of "en-UK" should be used in England. It is also appropriate to use "en" as the generic language in each case. If a US document goes to England, the "en-US" title is selected by using the "en" generic language and the "en-UK" specific language. It is considered poor practice, but allowed, to pass a specific language that is just an RFC 3066 primary tag. For example "en" is not a good specific language, it should only be used as a generic language. Passing "i" or "x" as the generic language is also considered poor practice but allowed. Advice from the W3C about the use of RFC 3066 language tags can be found at: http://www.w3.org/International/articles/language-tags/Note: RFC 3066 language tags must be treated in a case insensitive manner. The XMP Toolkit does this by normalizing their capitalization:
- The primary subtag is lower case, the suggested practice of ISO 639.
- All 2 letter secondary subtags are upper case, the suggested practice of ISO 3166.
- All other subtags are lower case. The XMP specification defines an artificial language,
- "x-default", that is used to explicitly denote a default item in an alt-text array.
- Look for an exact match with the specific language.
- If a generic language is given, look for a partial match.
- Look for an x-default item.
- Choose the first item.
getLocalizedText
returns information about a selected item in an alt-text array. The array item is selected according to the rules given above. Note: In a future version of this API a method using Javajava.lang.Locale
will be added.- Specified by:
getLocalizedText
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the alt-text array. Has the same usage as ingetProperty()
.altTextName
- The name of the alt-text array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.genericLang
- The name of the generic language as an RFC 3066 primary subtag. May benull
or the empty string if no generic language is wanted.specificLang
- The name of the specific language as an RFC 3066 tag. Must not benull
or the empty string.- Returns:
- Returns an
XMPProperty
containing the value, the actual language and the options if an appropriate alternate collection item exists,null
if the property. does not exist. - Throws:
XMPException
- See Also:
XMPMeta.getLocalizedText(String, String, String, String)
-
setLocalizedText
public void setLocalizedText(java.lang.String schemaNS, java.lang.String altTextName, java.lang.String genericLang, java.lang.String specificLang, java.lang.String itemValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Modifies the value of a selected item in an alt-text array. Creates an appropriate array item if necessary, and handles special cases for the x-default item. If the selected item is from a match with the specific language, the value of that item is modified. If the existing value of that item matches the existing value of the x-default item, the x-default item is also modified. If the array only has 1 existing item (which is not x-default), an x-default item is added with the given value. If the selected item is from a match with the generic language and there are no other generic matches, the value of that item is modified. If the existing value of that item matches the existing value of the x-default item, the x-default item is also modified. If the array only has 1 existing item (which is not x-default), an x-default item is added with the given value. If the selected item is from a partial match with the generic language and there are other partial matches, a new item is created for the specific language. The x-default item is not modified. If the selected item is from the last 2 rules then a new item is created for the specific language. If the array only had an x-default item, the x-default item is also modified. If the array was empty, items are created for the specific language and x-default. Note: In a future version of this API a method using Javajava.lang.Locale
will be added.- Specified by:
setLocalizedText
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the alt-text array. Has the same usage as ingetProperty()
.altTextName
- The name of the alt-text array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.genericLang
- The name of the generic language as an RFC 3066 primary subtag. May benull
or the empty string if no generic language is wanted.specificLang
- The name of the specific language as an RFC 3066 tag. Must not benull
or the empty string.itemValue
- A pointer to thenull
terminated UTF-8 string that is the new value for the appropriate array item.options
- Option flags, none are defined at present.- Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.setLocalizedText(String, String, String, String, String, PropertyOptions)
-
setLocalizedText
public void setLocalizedText(java.lang.String schemaNS, java.lang.String altTextName, java.lang.String genericLang, java.lang.String specificLang, java.lang.String itemValue) throws XMPException
- Specified by:
setLocalizedText
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the alt-text arrayaltTextName
- The name of the alt-text arraygenericLang
- The name of the generic languagespecificLang
- The name of the specific languageitemValue
- the new value for the appropriate array item- Throws:
XMPException
- Wraps all errors and exceptions- See Also:
XMPMeta.setLocalizedText(String, String, String, String, String)
-
getProperty
public XMPProperty getProperty(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
The property value getter-methods all take a property specification: the first two parameters are always the top level namespace URI (the "schema" namespace) and the basic name of the property being referenced. See the introductory discussion of path expression usage for more information.All of the functions return an object inherited from
PropertyBase
ornull
if the property does not exists. The result object contains the value of the property and option flags describing the property. Arrays and the non-leaf levels of nodes do not have values.See
PropertyOptions
for detailed information about the options.This is the simplest property getter, mainly for top level simple properties or after using the path composition functions in XMPPathFactory.
- Specified by:
getProperty
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. May benull
or the empty string if the first component of the propName path contains a namespace prefix. The URI must be for a registered namespace.propName
- The name of the property. May be a general path expression, must not benull
or the empty string. Using a namespace prefix on the first component is optional. If present without a schemaNS value then the prefix specifies the namespace. The prefix must be for a registered namespace. If both a schemaNS URI and propName prefix are present, they must be corresponding parts of a registered namespace.- Returns:
- Returns a
XMPProperty
containing the value and the options ornull
if the property does not exist. - Throws:
XMPException
- See Also:
XMPMeta.getProperty(String, String)
-
getProperty
protected XMPProperty getProperty(java.lang.String schemaNS, java.lang.String propName, int valueType) throws XMPException
Returns a property, but the result value can be requested. It can be one ofVALUE_STRING
,VALUE_BOOLEAN
,VALUE_INTEGER
,VALUE_LONG
,VALUE_DOUBLE
,VALUE_DATE
,VALUE_CALENDAR
,VALUE_BASE64
.- Parameters:
schemaNS
- a schema namespacepropName
- a property name or pathvalueType
- the type of the value, see VALUE_...- Returns:
- Returns an
XMPProperty
- Throws:
XMPException
- Collects any exception that occurs.- See Also:
XMPMeta.getProperty(String, String)
-
getPropertyObject
protected java.lang.Object getPropertyObject(java.lang.String schemaNS, java.lang.String propName, int valueType) throws XMPException
Returns a property, but the result value can be requested.- Parameters:
schemaNS
- a schema namespacepropName
- a property name or pathvalueType
- the type of the value, see VALUE_...- Returns:
- Returns the node value as an object according to the
valueType
. - Throws:
XMPException
- Collects any exception that occurs.- See Also:
XMPMeta.getProperty(String, String)
-
getPropertyBoolean
public java.lang.Boolean getPropertyBoolean(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
These are very similar togetProperty()
andSetProperty()
above, but the value is returned or provided in a literal form instead of as a UTF-8 string. The path composition functions inXMPPathFactory
may be used to compose an path expression for fields in nested structures, items in arrays, or qualifiers.- Specified by:
getPropertyBoolean
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns a
Boolean
value ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyBoolean(String, String)
-
setPropertyBoolean
public void setPropertyBoolean(java.lang.String schemaNS, java.lang.String propName, boolean propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Convenience method to set a property to a literalboolean
value.- Specified by:
setPropertyBoolean
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as insetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the literal property value asboolean
.options
- options of the property to set (optional).- Throws:
XMPException
- See Also:
XMPMeta.setPropertyBoolean(String, String, boolean, PropertyOptions)
-
setPropertyBoolean
public void setPropertyBoolean(java.lang.String schemaNS, java.lang.String propName, boolean propValue) throws XMPException
- Specified by:
setPropertyBoolean
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the propertypropName
- The name of the propertypropValue
- the literal property value asboolean
- Throws:
XMPException
- Wraps all exceptions- See Also:
XMPMeta.setPropertyBoolean(String, String, boolean)
-
getPropertyInteger
public java.lang.Integer getPropertyInteger(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
Convenience method to retrieve the literal value of a property.- Specified by:
getPropertyInteger
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns an
Integer
value ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyInteger(String, String)
-
setPropertyInteger
public void setPropertyInteger(java.lang.String schemaNS, java.lang.String propName, int propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Convenience method to set a property to a literalint
value.- Specified by:
setPropertyInteger
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as insetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the literal property value asint
.options
- options of the property to set (optional).- Throws:
XMPException
- Wraps all exceptions that may occur.- See Also:
XMPMeta.setPropertyInteger(String, String, int, PropertyOptions)
-
setPropertyInteger
public void setPropertyInteger(java.lang.String schemaNS, java.lang.String propName, int propValue) throws XMPException
- Specified by:
setPropertyInteger
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the propertypropName
- The name of the propertypropValue
- the literal property value asint
- Throws:
XMPException
- Wraps all exceptions- See Also:
XMPMeta.setPropertyInteger(String, String, int)
-
getPropertyLong
public java.lang.Long getPropertyLong(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
Convenience method to retrieve the literal value of a property.- Specified by:
getPropertyLong
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns a
Long
value ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyLong(String, String)
-
setPropertyLong
public void setPropertyLong(java.lang.String schemaNS, java.lang.String propName, long propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Convenience method to set a property to a literallong
value.- Specified by:
setPropertyLong
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as insetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the literal property value aslong
.options
- options of the property to set (optional).- Throws:
XMPException
- Wraps all exceptions that may occur.- See Also:
XMPMeta.setPropertyLong(String, String, long, PropertyOptions)
-
setPropertyLong
public void setPropertyLong(java.lang.String schemaNS, java.lang.String propName, long propValue) throws XMPException
- Specified by:
setPropertyLong
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the propertypropName
- The name of the propertypropValue
- the literal property value aslong
- Throws:
XMPException
- Wraps all exceptions- See Also:
XMPMeta.setPropertyLong(String, String, long)
-
getPropertyDouble
public java.lang.Double getPropertyDouble(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
Convenience method to retrieve the literal value of a property.- Specified by:
getPropertyDouble
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns a
Double
value ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyDouble(String, String)
-
setPropertyDouble
public void setPropertyDouble(java.lang.String schemaNS, java.lang.String propName, double propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Convenience method to set a property to a literaldouble
value.- Specified by:
setPropertyDouble
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as insetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the literal property value asdouble
.options
- options of the property to set (optional).- Throws:
XMPException
- Wraps all exceptions that may occur.- See Also:
XMPMeta.setPropertyDouble(String, String, double, PropertyOptions)
-
setPropertyDouble
public void setPropertyDouble(java.lang.String schemaNS, java.lang.String propName, double propValue) throws XMPException
- Specified by:
setPropertyDouble
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the propertypropName
- The name of the propertypropValue
- the literal property value asdouble
- Throws:
XMPException
- Wraps all exceptions- See Also:
XMPMeta.setPropertyDouble(String, String, double)
-
getPropertyDate
public XMPDateTime getPropertyDate(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
Convenience method to retrieve the literal value of a property.- Specified by:
getPropertyDate
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns a
XMPDateTime
-object ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyDate(String, String)
-
setPropertyDate
public void setPropertyDate(java.lang.String schemaNS, java.lang.String propName, XMPDateTime propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Convenience method to set a property with an XMPDateTime-object, which is serialized to an ISO8601 date.- Specified by:
setPropertyDate
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as insetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the property value asXMPDateTime
.options
- options of the property to set (optional).- Throws:
XMPException
- Wraps all exceptions that may occur.- See Also:
XMPMeta.setPropertyDate(String, String, XMPDateTime, PropertyOptions)
-
setPropertyDate
public void setPropertyDate(java.lang.String schemaNS, java.lang.String propName, XMPDateTime propValue) throws XMPException
- Specified by:
setPropertyDate
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the propertypropName
- The name of the propertypropValue
- the property value asXMPDateTime
- Throws:
XMPException
- Wraps all exceptions- See Also:
XMPMeta.setPropertyDate(String, String, XMPDateTime)
-
getPropertyCalendar
public java.util.Calendar getPropertyCalendar(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
Convenience method to retrieve the literal value of a property.- Specified by:
getPropertyCalendar
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns a Java
Calendar
-object ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyCalendar(String, String)
-
setPropertyCalendar
public void setPropertyCalendar(java.lang.String schemaNS, java.lang.String propName, java.util.Calendar propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Convenience method to set a property with a Java Calendar-object, which is serialized to an ISO8601 date.- Specified by:
setPropertyCalendar
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as insetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the property value as JavaCalendar
.options
- options of the property to set (optional).- Throws:
XMPException
- Wraps all exceptions that may occur.- See Also:
XMPMeta.setPropertyCalendar(String, String, Calendar, PropertyOptions)
-
setPropertyCalendar
public void setPropertyCalendar(java.lang.String schemaNS, java.lang.String propName, java.util.Calendar propValue) throws XMPException
- Specified by:
setPropertyCalendar
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the propertypropName
- The name of the propertypropValue
- the property value asCalendar
- Throws:
XMPException
- Wraps all exceptions- See Also:
XMPMeta.setPropertyCalendar(String, String, Calendar)
-
getPropertyBase64
public byte[] getPropertyBase64(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
Convenience method to retrieve the literal value of a property.- Specified by:
getPropertyBase64
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns a
byte[]
-array contained the decoded base64 value ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyBase64(String, String)
-
getPropertyString
public java.lang.String getPropertyString(java.lang.String schemaNS, java.lang.String propName) throws XMPException
Description copied from interface:XMPMeta
Convenience method to retrieve the literal value of a property. Note: There is nosetPropertyString()
, becausesetProperty()
sets a string value.- Specified by:
getPropertyString
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as ingetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.- Returns:
- Returns a
String
value ornull
if the property does not exist. - Throws:
XMPException
- Wraps all exceptions that may occur, especially conversion errors.- See Also:
XMPMeta.getPropertyString(String, String)
-
setPropertyBase64
public void setPropertyBase64(java.lang.String schemaNS, java.lang.String propName, byte[] propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Convenience method to set a property from a binarybyte[]
-array, which is serialized as base64-string.- Specified by:
setPropertyBase64
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as insetProperty()
.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the literal property value as byte array.options
- options of the property to set (optional).- Throws:
XMPException
- Wraps all exceptions that may occur.- See Also:
XMPMeta.setPropertyBase64(String, String, byte[], PropertyOptions)
-
setPropertyBase64
public void setPropertyBase64(java.lang.String schemaNS, java.lang.String propName, byte[] propValue) throws XMPException
- Specified by:
setPropertyBase64
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the propertypropName
- The name of the propertypropValue
- the literal property value as byte array- Throws:
XMPException
- Wraps all exceptions- See Also:
XMPMeta.setPropertyBase64(String, String, byte[])
-
getQualifier
public XMPProperty getQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName) throws XMPException
Description copied from interface:XMPMeta
Provides access to a qualifier attached to a property. The namespace for the qualifier is passed as a URI, you need not worry about the path string syntax. In many regards qualifiers are like struct fields. See the introductory discussion of qualified properties for more information.The names of qualifiers should be XML qualified names, that is within an XML namespace. The path syntax for a qualified name uses the namespace prefix. This is unreliable since the prefix is never guaranteed. The URI is the formal name, the prefix is just a local shorthand in a given sequence of XML text.
Note: Qualifiers are only supported for simple leaf properties at this time.
- Specified by:
getQualifier
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as in getProperty.propName
- The name of the property to which the qualifier is attached. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as ingetProperty()
.qualNS
- The namespace URI for the qualifier. Has the same URI and prefix usage as the schemaNS parameter.qualName
- The name of the qualifier. Must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the propName parameter.- Returns:
- Returns a
XMPProperty
containing the value and the options of the qualifier ornull
if the property does not exist. The name of the qualifier must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the propName parameter.The value of the qualifier is only set if it has one (Arrays and non-leaf levels of structs do not have values).
- Throws:
XMPException
- See Also:
XMPMeta.getQualifier(String, String, String, String)
-
getStructField
public XMPProperty getStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName) throws XMPException
Description copied from interface:XMPMeta
Provides access to fields within a nested structure. The namespace for the field is passed as a URI, you need not worry about the path string syntax.The names of fields should be XML qualified names, that is within an XML namespace. The path syntax for a qualified name uses the namespace prefix. This is unreliable since the prefix is never guaranteed. The URI is the formal name, the prefix is just a local shorthand in a given sequence of XML text.
- Specified by:
getStructField
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as in getProperty.structName
- The name of the struct. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName ingetProperty()
.fieldNS
- The namespace URI for the field. Has the same URI and prefix usage as the schemaNS parameter.fieldName
- The name of the field. Must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the structName parameter.- Returns:
- Returns a
XMPProperty
containing the value and the options ornull
if the property does not exist. Arrays and non-leaf levels of structs do not have values. - Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.getStructField(String, String, String, String)
-
iterator
public XMPIterator iterator() throws XMPException
Description copied from interface:XMPMeta
Constructs an iterator for the properties within this XMP object.- Specified by:
iterator
in interfaceXMPMeta
- Returns:
- Returns an
XMPIterator
. - Throws:
XMPException
- See Also:
XMPMeta.iterator()
-
iterator
public XMPIterator iterator(IteratorOptions options) throws XMPException
Description copied from interface:XMPMeta
Constructs an iterator for the properties within this XMP object using some options.- Specified by:
iterator
in interfaceXMPMeta
- Parameters:
options
- Option flags to control the iteration.- Returns:
- Returns an
XMPIterator
. - Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.iterator(IteratorOptions)
-
iterator
public XMPIterator iterator(java.lang.String schemaNS, java.lang.String propName, IteratorOptions options) throws XMPException
Description copied from interface:XMPMeta
Construct an iterator for the properties within an XMP object. According to the parameters it iterates the entire data tree, properties within a specific schema, or a subtree rooted at a specific node.- Specified by:
iterator
in interfaceXMPMeta
- Parameters:
schemaNS
- Optional schema namespace URI to restrict the iteration. Omitted (visit all schema) by passingnull
or empty String.propName
- Optional property name to restrict the iteration. May be an arbitrary path expression. Omitted (visit all properties) by passingnull
or empty String. If no schema URI is given, it is ignored.options
- Option flags to control the iteration. SeeIteratorOptions
for details.- Returns:
- Returns an
XMPIterator
for thisXMPMeta
-object considering the given options. - Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.iterator(String, String, IteratorOptions)
-
setArrayItem
public void setArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Replaces an item within an array. The index is passed as an integer, you need not worry about the path string syntax for array items, convert a loop index to a string, etc. The array passed must already exist. In normal usage the selected array item is modified. A new item is automatically appended if the index is the array size plus 1.- Specified by:
setArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the array. Has the same usage as in getProperty.arrayName
- The name of the array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName in getProperty.itemIndex
- The index of the desired item. Arrays in XMP are indexed from 1. To address the last existing item, useXMPMeta.countArrayItems(String, String)
to find out the length of the array.itemValue
- the new value of the array item. Has the same usage as propValue insetProperty()
.options
- the set options for the item.- Throws:
XMPException
- See Also:
XMPMeta.setArrayItem(String, String, int, String, PropertyOptions)
-
setArrayItem
public void setArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue) throws XMPException
- Specified by:
setArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URIarrayName
- The name of the arrayitemIndex
- The index to insert the new itemitemValue
- the new value of the array item- Throws:
XMPException
- Wraps all errors and exceptions- See Also:
XMPMeta.setArrayItem(String, String, int, String)
-
insertArrayItem
public void insertArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Inserts an item into an array previous to the given index. The index is passed as an integer, you need not worry about the path string syntax for array items, convert a loop index to a string, etc. The array passed must already exist. In normal usage the selected array item is modified. A new item is automatically appended if the index is the array size plus 1.- Specified by:
insertArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the array. Has the same usage as in getProperty.arrayName
- The name of the array. May be a general path expression, must not benull
or the empty string. Has the same namespace prefix usage as propName in getProperty.itemIndex
- The index to insert the new item. Arrays in XMP are indexed from 1. UseXMPConst.ARRAY_LAST_ITEM
to append items.itemValue
- the new value of the array item. Has the same usage as propValue insetProperty()
.options
- the set options that decide about the kind of the node.- Throws:
XMPException
- See Also:
XMPMeta.insertArrayItem(String, String, int, String, PropertyOptions)
-
insertArrayItem
public void insertArrayItem(java.lang.String schemaNS, java.lang.String arrayName, int itemIndex, java.lang.String itemValue) throws XMPException
- Specified by:
insertArrayItem
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the arrayarrayName
- The name of the arrayitemIndex
- The index to insert the new itemitemValue
- the value of the array item- Throws:
XMPException
- Wraps all errors and exceptions- See Also:
XMPMeta.insertArrayItem(String, String, int, String)
-
setProperty
public void setProperty(java.lang.String schemaNS, java.lang.String propName, java.lang.Object propValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
The property valuesetters
all take a property specification, their differences are in the form of this. The first two parameters are always the top level namespace URI (theschema
namespace) and the basic name of the property being referenced. See the introductory discussion of path expression usage for more information.All of the functions take a string value for the property and option flags describing the property. The value must be Unicode in UTF-8 encoding. Arrays and non-leaf levels of structs do not have values. Empty arrays and structs may be created using appropriate option flags. All levels of structs that is assigned implicitly are created if necessary. appendArayItem implicitly creates the named array if necessary.
See
PropertyOptions
for detailed information about the options.This is the simplest property setter, mainly for top level simple properties or after using the path composition functions in
XMPPathFactory
.- Specified by:
setProperty
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as in getProperty.propName
- The name of the property. Has the same usage as ingetProperty()
.propValue
- the value for the property (only leaf properties have a value). Arrays and non-leaf levels of structs do not have values. Must benull
if the value is not relevant.
The value is automatically detected: Boolean, Integer, Long, Double, XMPDateTime and byte[] are handled, on all othertoString()
is called.options
- Option flags describing the property. See the earlier description.- Throws:
XMPException
- See Also:
XMPMeta.setProperty(String, String, Object, PropertyOptions)
-
setProperty
public void setProperty(java.lang.String schemaNS, java.lang.String propName, java.lang.Object propValue) throws XMPException
- Specified by:
setProperty
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URIpropName
- The name of the propertypropValue
- the value for the property- Throws:
XMPException
- Wraps all errors and exceptions- See Also:
XMPMeta.setProperty(String, String, Object)
-
setQualifier
public void setQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName, java.lang.String qualValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Provides access to a qualifier attached to a property. The namespace for the qualifier is passed as a URI, you need not worry about the path string syntax. In many regards qualifiers are like struct fields. See the introductory discussion of qualified properties for more information. The names of qualifiers should be XML qualified names, that is within an XML namespace. The path syntax for a qualified name uses the namespace prefix, which is unreliable because the prefix is never guaranteed. The URI is the formal name, the prefix is just a local shorthand in a given sequence of XML text. The property the qualifier will be attached has to exist.- Specified by:
setQualifier
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as in getProperty.propName
- The name of the property to which the qualifier is attached. Has the same usage as in getProperty.qualNS
- The namespace URI for the qualifier. Has the same URI and prefix usage as the schemaNS parameter.qualName
- The name of the qualifier. Must be a single XML name, must not benull
or the empty string. Has the same namespace prefix usage as the propName parameter.qualValue
- A pointer to thenull
terminated UTF-8 string that is the value of the qualifier, if the qualifier has a value. Has the same usage as propValue in getProperty.options
- Option flags describing the qualifier. See the earlier description.- Throws:
XMPException
- See Also:
XMPMeta.setQualifier(String, String, String, String, String, PropertyOptions)
-
setQualifier
public void setQualifier(java.lang.String schemaNS, java.lang.String propName, java.lang.String qualNS, java.lang.String qualName, java.lang.String qualValue) throws XMPException
- Specified by:
setQualifier
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the structpropName
- The name of the property to which the qualifier is attachedqualNS
- The namespace URI for the qualifierqualName
- The name of the qualifierqualValue
- the value of the qualifier- Throws:
XMPException
- Wraps all errors and exceptions- See Also:
XMPMeta.setQualifier(String, String, String, String, String)
-
setStructField
public void setStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName, java.lang.String fieldValue, PropertyOptions options) throws XMPException
Description copied from interface:XMPMeta
Provides access to fields within a nested structure. The namespace for the field is passed as a URI, you need not worry about the path string syntax. The names of fields should be XML qualified names, that is within an XML namespace. The path syntax for a qualified name uses the namespace prefix, which is unreliable because the prefix is never guaranteed. The URI is the formal name, the prefix is just a local shorthand in a given sequence of XML text.- Specified by:
setStructField
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the struct. Has the same usage as in getProperty.structName
- The name of the struct. May be a general path expression, must not be null or the empty string. Has the same namespace prefix usage as propName in getProperty.fieldNS
- The namespace URI for the field. Has the same URI and prefix usage as the schemaNS parameter.fieldName
- The name of the field. Must be a single XML name, must not be null or the empty string. Has the same namespace prefix usage as the structName parameter.fieldValue
- the value of thefield, if the field has a value. Has the same usage as propValue in getProperty.options
- Option flags describing the field. See the earlier description.- Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.setStructField(String, String, String, String, String, PropertyOptions)
-
setStructField
public void setStructField(java.lang.String schemaNS, java.lang.String structName, java.lang.String fieldNS, java.lang.String fieldName, java.lang.String fieldValue) throws XMPException
- Specified by:
setStructField
in interfaceXMPMeta
- Parameters:
schemaNS
- The namespace URI for the structstructName
- The name of the structfieldNS
- The namespace URI for the fieldfieldName
- The name of the fieldfieldValue
- the value of the field- Throws:
XMPException
- Wraps all errors and exceptions- See Also:
XMPMeta.setStructField(String, String, String, String, String)
-
getObjectName
public java.lang.String getObjectName()
Description copied from interface:XMPMeta
This correlates to the about-attribute, returns the empty String if no name is set.- Specified by:
getObjectName
in interfaceXMPMeta
- Returns:
- Returns the name of the XMP object.
- See Also:
XMPMeta.getObjectName()
-
setObjectName
public void setObjectName(java.lang.String name)
- Specified by:
setObjectName
in interfaceXMPMeta
- Parameters:
name
- Sets the name of the XMP object.- See Also:
XMPMeta.setObjectName(String)
-
getPacketHeader
public java.lang.String getPacketHeader()
- Specified by:
getPacketHeader
in interfaceXMPMeta
- Returns:
- Returns the unparsed content of the <?xpacket> processing instruction.
This contains normally the attribute-like elements 'begin="<BOM>"
id="W5M0MpCehiHzreSzNTczkc9d"' and possibly the deprecated elements 'bytes="1234"' or
'encoding="XXX"'. If the parsed packet has not been wrapped into an xpacket,
null
is returned. - See Also:
XMPMeta.getPacketHeader()
-
setPacketHeader
public void setPacketHeader(java.lang.String packetHeader)
Sets the packetHeader attributes, only used by the parser.- Parameters:
packetHeader
- the processing instruction content
-
clone
public java.lang.Object clone()
Performs a deep clone of the XMPMeta-object
-
dumpObject
public java.lang.String dumpObject()
Description copied from interface:XMPMeta
Renders this node and the tree unter this node in a human readable form.- Specified by:
dumpObject
in interfaceXMPMeta
- Returns:
- Returns a multiline string containing the dump.
- See Also:
XMPMeta.dumpObject()
-
sort
public void sort()
Description copied from interface:XMPMeta
Sorts the complete datamodel according to the following rules:- Schema nodes are sorted by prefix.
- Properties at top level and within structs are sorted by full name, that is prefix + local name.
- Array items are not sorted, even if they have no certain order such as bags.
- Qualifier are sorted, with the exception of "xml:lang" and/or "rdf:type" that stay at the top of the list in that order.
- Specified by:
sort
in interfaceXMPMeta
- See Also:
XMPMeta.sort()
-
normalize
public void normalize(ParseOptions options) throws XMPException
Description copied from interface:XMPMeta
Perform the normalization as a separate parsing step. Normally it is done during parsing, unless the parsing optionParseOptions.OMIT_NORMALIZATION
is set totrue
. Note: It does no harm to call this method to an already normalized xmp object. It was a PDF/A requirement to get hand on the unnormalizedXMPMeta
object.- Specified by:
normalize
in interfaceXMPMeta
- Parameters:
options
- optional parsing options.- Throws:
XMPException
- Wraps all errors and exceptions that may occur.- See Also:
XMPMeta.normalize(ParseOptions)
-
getRoot
public XMPNode getRoot()
- Returns:
- Returns the root node of the XMP tree.
-
doSetArrayItem
private void doSetArrayItem(XMPNode arrayNode, int itemIndex, java.lang.String itemValue, PropertyOptions itemOptions, boolean insert) throws XMPException
Locate or create the item node and set the value. Note the index parameter is one-based! The index can be in the range [1..size + 1] or "last()", normalize it and check the insert flags. The order of the normalization checks is important. If the array is empty we end up with an index and location to set item size + 1.- Parameters:
arrayNode
- an array nodeitemIndex
- the index where to insert the itemitemValue
- the item valueitemOptions
- the options for the new iteminsert
- insert oder overwrite at index position?- Throws:
XMPException
-
setNode
void setNode(XMPNode node, java.lang.Object value, PropertyOptions newOptions, boolean deleteExisting) throws XMPException
The internals for setProperty() and related calls, used after the node is found or created.- Parameters:
node
- the newly created nodevalue
- the node value, can benull
newOptions
- options for the new node, must not benull
.deleteExisting
- flag if the existing value is to be overwritten- Throws:
XMPException
- thrown if options and value do not correspond
-
evaluateNodeValue
private java.lang.Object evaluateNodeValue(int valueType, XMPNode propNode) throws XMPException
Evaluates a raw node value to the given value type, apply special conversions for defined types in XMP.- Parameters:
valueType
- an int indicating the value typepropNode
- the node containing the value- Returns:
- Returns a literal value for the node.
- Throws:
XMPException
-
-