XmpCore
Byte buffer container including length of valid data.
Stefan Makswit
11.10.2006
Returns the length, that means the number of valid bytes, of the buffer;
the inner byte array might be bigger than that.
the inner byte array might be bigger than that.
the initial capacity for this buffer
a byte array that will be wrapped with ByteBuffer.
a byte array that will be wrapped with ByteBuffer.
the length of valid bytes in the array
Loads the stream into a buffer.
an Stream
If the stream cannot be read.
a byte array that will be wrapped with ByteBuffer.
the offset of the provided buffer.
the length of valid bytes in the array
Returns a byte stream that is limited to the valid amount of bytes.
the index to retrieve the byte from
Returns a byte from the buffer
the index to retrieve a byte as int or char.
Returns a byte from the buffer
Appends a byte to the buffer.
a byte
Appends a byte array or part of to the buffer.
a byte array
an offset with
Append a byte array to the buffer
a byte array
Append another buffer to this buffer.
another ByteBuffer
Detects the encoding of the byte buffer, stores and returns it.
Detects the encoding of the byte buffer, stores and returns it.
Only UTF-8, UTF-16LE/BE and UTF-32LE/BE are recognized.
Returns the encoding string.
Ensures the requested capacity by increasing the buffer size when the
current length is exceeded.
requested new buffer length
Stefan Makswit
22.08.2006
the state of the automaton
the result of the escaping sequence
count the digits of the sequence
The look-ahead size is 6 at maximum («)
a Reader
Processes numeric escaped chars to find out if they are a control character.
a char
Returns the char directly or as replacement for the escaped sequence.
Converts between ISO 8601 Strings and Calendar with millisecond resolution.
Stefan Makswit
16.02.2006
Converts an ISO 8601 string to an XMPDateTime.
Converts an ISO 8601 string to an XMPDateTime.
Parse a date according to ISO 8601 and
http://www.w3.org/TR/NOTE-datetime:
- YYYY
- YYYY-MM
- YYYY-MM-DD
- YYYY-MM-DDThh:mmTZD
- YYYY-MM-DDThh:mm:ssTZD
- YYYY-MM-DDThh:mm:ss.sTZD
Data fields:
- YYYY = four-digit year
- MM = two-digit month (01=January, etc.)
- DD = two-digit day of month (01 through 31)
- hh = two digits of hour (00 through 23)
- mm = two digits of minute (00 through 59)
- ss = two digits of second (00 through 59)
- s = one or more digits representing a decimal fraction of a second
- TZD = time zone designator (Z or +hh:mm or -hh:mm)
Note that ISO 8601 does not seem to allow years less than 1000 or greater
than 9999. We allow any year, even negative ones. The year is formatted
as "%.4d".
Note: Tolerate missing TZD, assume is UTC. Photoshop 8 writes
dates like this for exif:GPSTimeStamp.
Note: DOES NOT APPLY ANYMORE.
Tolerate missing date portion, in case someone foolishly
writes a time-only value that way.
a date string that is ISO 8601 conform.
Returns a Calendar.
Is thrown when the string is non-conform.
a date string that is ISO 8601 conform.
an existing XMPDateTime to set with the parsed date
Returns an XMPDateTime-object containing the ISO8601-date.
Is thrown when the string is non-conform.
Converts a Calendar into an ISO 8601 string.
Converts a Calendar into an ISO 8601 string.
Format a date according to ISO 8601 and http://www.w3.org/TR/NOTE-datetime:
- YYYY
- YYYY-MM
- YYYY-MM-DD
- YYYY-MM-DDThh:mmTZD
- YYYY-MM-DDThh:mm:ssTZD
- YYYY-MM-DDThh:mm:ss.sTZD
Data fields:
- YYYY = four-digit year
- MM = two-digit month (01=January, etc.)
- DD = two-digit day of month (01 through 31)
- hh = two digits of hour (00 through 23)
- mm = two digits of minute (00 through 59)
- ss = two digits of second (00 through 59)
- s = one or more digits representing a decimal fraction of a second
- TZD = time zone designator (Z or +hh:mm or -hh:mm)
Note: ISO 8601 does not seem to allow years less than 1000 or greater than 9999.
We allow any year, even negative ones. The year is formatted as "%.4d".
Note: Fix for bug 1269463 (silently fix out of range values) included in parsing.
The quasi-bogus "time only" values from Photoshop CS are not supported.
an XMPDateTime-object.
Returns an ISO 8601 string.
Stefan Makswit
22.08.2006
Returns the current position.
initializes the parser container
Returns whether there are more chars to come.
index of char
Returns char at a certain index.
Returns the current char or 0x0000 if there are no more chars.
Skips the next char.
Parses a integer from the source and sets the pointer after it.
Error message to put in the exception if no number can be found
the max value of the number to return
Returns the parsed integer.
Thrown if no integer can be found.
Stefan Makswit
12.10.2006
A converter that processes a byte buffer containing a mix of UTF8 and Latin-1/Cp1252 chars.
A converter that processes a byte buffer containing a mix of UTF8 and Latin-1/Cp1252 chars.
The result is a buffer where those chars have been converted to UTF-8;
that means it contains only valid UTF-8 chars.
Explanation of the processing: First the encoding of the buffer is detected looking
at the first four bytes (that works only if the buffer starts with an ASCII-char,
like xmls '<'). UTF-16/32 flavours do not require further proccessing.
In the case, UTF-8 is detected, it assumes wrong UTF8 chars to be a sequence of
Latin-1/Cp1252 encoded bytes and converts the chars to their corresponding UTF-8 byte
sequence.
The 0x80..0x9F range is undefined in Latin-1, but is defined in Windows code
page 1252. The bytes 0x81, 0x8D, 0x8F, 0x90, and 0x9D are formally undefined
by Windows 1252. These are in XML's RestrictedChar set, so we map them to a
space.
The official Latin-1 characters in the range 0xA0..0xFF are converted into
the Unicode Latin Supplement range U+00A0 - U+00FF.
Example: If an Euro-symbol (€) appears in the byte buffer (0xE2, 0x82, 0xAC),
it will be left as is. But if only the first two bytes are appearing,
followed by an ASCII char a (0xE2 - 0x82 - 0x41), it will be converted to
0xC3, 0xA2 (â) - 0xE2, 0x80, 0x9A (‚) - 0x41 (a).
a byte buffer contain
Returns a new buffer containing valid UTF-8
Converts a Cp1252 char (contains all Latin-1 chars above 0x80) into a
UTF-8 byte sequence.
Converts a Cp1252 char (contains all Latin-1 chars above 0x80) into a
UTF-8 byte sequence. The bytes 0x81, 0x8D, 0x8F, 0x90, and 0x9D are
formally undefined by Windows 1252 and therefore replaced by a space
(0x20).
an Cp1252 / Latin-1 byte
Returns a byte array containing a UTF-8 byte sequence.
Stefan Makswit
11.08.2006
Asserts that an array name is set.
an array name
Array name is null or empty
Asserts that a property name is set.
a property name or path
Property name is null or empty
Asserts that a schema namespace is set.
a schema namespace
Schema is null or empty
Asserts that a prefix is set.
a prefix
Prefix is null or empty
Asserts that a specific language is set.
a specific lang
Specific language is null or empty
Asserts that a struct name is set.
a struct name
Struct name is null or empty
Asserts that a parameter is not null.
the parameter's value
Thrown if the parameter is null.
Asserts that any string parameter is not null or empty.
a string parameter's value
Thrown if the parameter is null or has length 0.
Asserts that the xmp object is of this implemention ().
the XMP object
A wrong implentaion is used.
Start of coreSyntaxTerms.
End of coreSyntaxTerms
Start of additions for syntax Terms.
End of of additions for syntaxTerms.
Start of oldTerms.
End of oldTerms.
! Yes, the syntax terms include the core terms.
Parser for "normal" XML serialisation of RDF.
Stefan Makswit
14.07.2006
this prefix is used for default namespaces
The main parsing method.
The main parsing method. The XML tree is walked through from the root node and and XMP tree
is created. This is a raw parse, the normalisation of the XMP tree happens outside.
the XML root node
ParseOptions to indicate the parse options provided by the client
Returns an XMP metadata object (not normalized)
Occurs if the parsing fails for any reason.
Each of these parsing methods is responsible for recognizing an RDF
syntax production and adding the appropriate structure to the XMP tree.
Each of these parsing methods is responsible for recognizing an RDF
syntax production and adding the appropriate structure to the XMP tree.
They simply return for success, failures will throw an exception.
the xmp metadata object that is generated
the top-level xml node
ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.10 nodeElementList
ws* ( nodeElement ws* )
This method is only called from the rdf:RDF-node (top level).
the xmp metadata object that is generated
the parent xmp node
the top-level xml node
/// ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.5 nodeElementURIs
anyURI - ( coreSyntaxTerms | rdf:li | oldTerms )
7.2.11 nodeElement
start-element ( URI == nodeElementURIs,
attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) )
propertyEltList
end-element()
A node element URI is rdf:Description or anything else that is not an RDF
term.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.7 propertyAttributeURIs
anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms )
7.2.11 nodeElement
start-element ( URI == nodeElementURIs,
attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) )
propertyEltList
end-element()
Process the attribute list for an RDF node element. A property attribute URI is
anything other than an RDF term. The rdf:ID and rdf:nodeID attributes are simply ignored,
as are rdf:about attributes on inner nodes.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.13 propertyEltList
ws* ( propertyElt ws* )
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.14 propertyElt
resourcePropertyElt | literalPropertyElt | parseTypeLiteralPropertyElt |
parseTypeResourcePropertyElt | parseTypeCollectionPropertyElt |
parseTypeOtherPropertyElt | emptyPropertyElt
7.2.15 resourcePropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) )
ws* nodeElement ws
end-element()
7.2.16 literalPropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, datatypeAttr?) )
text()
end-element()
7.2.17 parseTypeLiteralPropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, parseLiteral ) )
literal
end-element()
7.2.18 parseTypeResourcePropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, parseResource ) )
propertyEltList
end-element()
7.2.19 parseTypeCollectionPropertyElt
start-element (
URI == propertyElementURIs, attributes == set ( idAttr?, parseCollection ) )
nodeElementList
end-element()
7.2.20 parseTypeOtherPropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) )
propertyEltList
end-element()
7.2.21 emptyPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr* ) )
end-element()
The various property element forms are not distinguished by the XML element name,
but by their attributes for the most part. The exceptions are resourcePropertyElt and
literalPropertyElt. They are distinguished by their XML element content.
NOTE: The RDF syntax does not explicitly include the xml:lang attribute although it can
appear in many of these. We have to allow for it in the attribute counts below.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.15 resourcePropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) )
ws* nodeElement ws
end-element()
This handles structs using an rdf:Description node,
arrays using rdf:Bag/Seq/Alt, and typedNodes. It also catches and cleans up qualified
properties written with rdf:Description and rdf:value.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.16 literalPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, datatypeAttr?) )
text()
end-element()
Add a leaf node with the text value and qualifiers for the attributes.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thrown on parsing errors
7.2.17 parseTypeLiteralPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, parseLiteral ) )
literal
end-element()
thrown on parsing errors
7.2.18 parseTypeResourcePropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, parseResource ) )
propertyEltList
end-element()
Add a new struct node with a qualifier for the possible rdf:ID attribute.
Then process the XML child nodes to get the struct fields.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
ParseOptions to indicate the parse options provided by the client
thrown on parsing errors
7.2.19 parseTypeCollectionPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set ( idAttr?, parseCollection ) )
nodeElementList
end-element()
thrown on parsing errors
7.2.20 parseTypeOtherPropertyElt
start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) )
propertyEltList
end-element()
thrown on parsing errors
7.2.21 emptyPropertyElt
start-element ( URI == propertyElementURIs,
attributes == set (
idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr* ) )
end-element()
<ns:Prop1/> <!-- a simple property with an empty value -->
<ns:Prop2 rdf:resource="http: *www.adobe.com/"/> <!-- a URI value -->
<ns:Prop3 rdf:value="..." ns:Qual="..."/> <!-- a simple qualified property -->
<ns:Prop4 ns:Field1="..." ns:Field2="..."/> <!-- a struct with simple fields -->
An emptyPropertyElt is an element with no contained content, just a possibly empty set of
attributes. An emptyPropertyElt can represent three special cases of simple XMP properties: a
simple property with an empty value (ns:Prop1), a simple property whose value is a URI
(ns:Prop2), or a simple property with simple qualifiers (ns:Prop3).
An emptyPropertyElt can also represent an XMP struct whose fields are all simple and
unqualified (ns:Prop4).
It is an error to use both rdf:value and rdf:resource - that can lead to invalid RDF in the
verbose form written using a literalPropertyElt.
The XMP mapping for an emptyPropertyElt is a bit different from generic RDF, partly for
design reasons and partly for historical reasons. The XMP mapping rules are:
- If there is an rdf:value attribute then this is a simple property
with a text value.
All other attributes are qualifiers.
- If there is an rdf:resource attribute then this is a simple property
with a URI value.
All other attributes are qualifiers.
- If there are no attributes other than xml:lang, rdf:ID, or rdf:nodeID
then this is a simple
property with an empty value.
- Otherwise this is a struct, the attributes other than xml:lang, rdf:ID,
or rdf:nodeID are fields.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Flag if the node is a top-level node
thrown on parsing errors
Adds a child node.
the xmp metadata object that is generated
the parent xmp node
the currently processed XML node
Node value
Flag if the node is a top-level node
Returns the newly created child node.
thrown on parsing errors
Adds a qualifier node.
the parent xmp node
the name of the qualifier which has to be
QName including the default prefix
the value of the qualifier
Returns the newly created child node.
thrown on parsing errors
The parent is an RDF pseudo-struct containing an rdf:value field.
The parent is an RDF pseudo-struct containing an rdf:value field. Fix the
XMP data model. The rdf:value node must be the first child, the other
children are qualifiers. The form, value, and children of the rdf:value
node are the real ones. The rdf:value node's qualifiers must be added to
the others.
the parent xmp node
thrown on parsing errors
Checks if the node is a white space.
an XML-node
Returns whether the node is a whitespace node,
i.e. a text node that contains only whitespaces.
7.2.6 propertyElementURIs
anyURI - ( coreSyntaxTerms | rdf:Description | oldTerms )
the term id
Return true if the term is a property element name.
7.2.4 oldTerms
rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID
the term id
Returns true if the term is an old term.
7.2.2 coreSyntaxTerms
rdf:RDF | rdf:ID | rdf:about | rdf:parseType | rdf:resource | rdf:nodeID |
rdf:datatype
the term id
Return true if the term is a core syntax term
Determines the ID for a certain RDF Term.
Arranged to hopefully minimize the parse time for large XMP.
an XML node
Returns the term ID.
Check if the child name
an XML node
Returns bool
Stefan Makswit
09.11.2006
Splits a qname into prefix and localname.
a QName
Constructor that initializes the fields
the prefix
the name
Returns whether the QName has a prefix.
XML localname
the localName
XML namespace prefix
the prefix
Utility functions for the XMPToolkit implementation.
Stefan Makswit
06.06.2006
segments of a UUID
length of a UUID
table of XML name start chars (<= 0xFF)
table of XML name chars (<= 0xFF)
Normalize an xml:lang value so that comparisons are effectively case
insensitive as required by RFC 3066 (which supersedes RFC 1766).
The normalization rules:
- 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.
raw value
Returns the normalized value.
Split the name and value parts for field and qualifier selectors.
- [qualName="value"] - An element in an array of structs, chosen by a field value.
- [?qualName="value"] - An element in an array, chosen by a qualifier value.
The value portion is a string quoted by ' or ". The value may contain
any character including a doubled quoting character. The value may be
empty.
Note: It is assumed that the expression is formal correct.
The selector
The name string
The value string
a schema namespace
an XMP Property
Returns true if the property is defined as "Internal
Property", see XMP Specification.
Check some requirements for an UUID:
- Length of the UUID is 32
- The Delimiter count is 4 and all the 4 delimiter are on their right position (8,13,18,23)
uuid to test
true - this is a well formed UUID, false - UUID has not the expected format
Simple check for valid XML names.
Within ASCII range
":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6]
are accepted, above all characters (which is not entirely
correct according to the XML Spec.
an XML Name
Return true if the name is correct.
Checks if the value is a legal "unqualified" XML name, as
defined in the XML Namespaces proposed recommendation.
These are XML names, except that they must not contain a colon.
the value to check
Returns true if the name is a valid "unqualified" XML name.
a char
Returns true if the char is an ASCII control char.
Serializes the node value in XML encoding.
Its used for tag bodies and attributes.
Note: The attribute is always limited by quotes,
thats why ' is never serialized.
Note: Control chars are written unescaped, but if the user uses others than tab, LF
and CR the resulting XML will become invalid.
a string
flag if string is attribute value (need to additional escape quotes)
Decides if LF, CR and TAB are escaped.
Returns the value ready for XML output.
Replaces the ASCII control chars with a space.
a node value
Returns the cleaned up value
Simple check if a character is a valid XML start name char.
Simple check if a character is a valid XML start name char.
All characters according to the XML Spec 1.1 are accepted:
http://www.w3.org/TR/xml11/#NT-NameStartChar
a character
Returns true if the character is a valid first char of an XML name.
Simple check if a character is a valid XML name char
(every char except the first one), according to the XML Spec 1.1:
http://www.w3.org/TR/xml11/#NT-NameChar
a character
Returns true if the character is a valid char of an XML name.
The default implementation of .
Stefan Makswit
16.02.2006
Use NO time zone as default
The nanoseconds take micro and nano seconds, while the milliseconds are in the calendar.
Creates an XMPDateTime-instance with the current time in the default time zone.
Creates an XMPDateTime-instance from a calendar.
a Calendar
Creates an XMPDateTime-instance from
a Date and a TimeZone.
a date describing an absolute point in time
a TimeZone how to interpret the date
Creates an XMPDateTime-instance from an ISO 8601 string.
an ISO 8601 string
If the string is a non-conform ISO 8601 string, an exception is thrown
Returns the ISO string representation.
Number of milliseconds since the Unix epoch (1970-01-01 00:00:00).
Number of milliseconds since the Unix epoch (1970-01-01 00:00:00).
The XMPIterator implementation.
The XMPIterator implementation.
Iterates the XMP Tree according to a set of options.
During the iteration the XMPMeta-object must not be changed.
Calls to skipSubtree() / skipSiblings() will affect the iteration.
Stefan Makswit
29.06.2006
flag to indicate that skipSiblings() has been called.
the node iterator doing the work
Constructor with optional initial values.
If propName is provided, schemaNS has also be provided.
the iterated metadata object.
the iteration is reduced to this schema (optional)
the iteration is reduced to this property within the schemaNS
advanced iteration options, see
If the node defined by the parameters is not existing.
the base namespace of the property path, will be changed during the iteration
The XMPIterator implementation.
The XMPIterator implementation.
It first returns the node itself, then recursively the children and qualifier of the node.
Stefan Makswit
29.06.2006
iteration state
iteration state
iteration state
the state of the iteration
the currently visited node
the recursively accumulated path
the iterator that goes through the children and qualifier list
index of node with parent, only interesting for arrays
the iterator for each child
the cached PropertyInfo to return
Default constructor
Constructor for the node iterator.
the currently visited node
the accumulated path of the node
the index within the parent node (only for arrays)
Prepares the next node to return if not already done.
Sets the returnProperty as next item or recurses into hasNext().
Returns if there is a next item to return.
Handles the iteration of the children or qualfier
an iterator
Returns if there are more elements available.
Calls hasNext() and returns the prepared node.
Calls hasNext() and returns the prepared node. Afterward it's set to null.
The existence of returnProperty indicates if there is a next node, otherwise
an exception is thrown.
Not supported.
the node that will be added to the path.
the path up to this node.
the current array index if an array is traversed
Returns the updated path.
Creates a property info object from an XMPNode.
an XMPNode
the base namespace to report
the full property path
Returns a XMPProperty-object that serves representation of the node.
Originally called "XmpPropertyInfo450"
"450" was the line number in XMPIteratorImpl.java of the Adobe Java 5.1.2 source file
This class was anonymous, but that is unnecessary here
Returns the returnProperty.
the returnProperty to set
This iterator is derived from the default NodeIterator,
and is only used for the option .
Stefan Makswit
02.10.2006
Constructor
the node which children shall be iterated.
the full path of the former node without the leaf node.
Prepares the next node to return if not already done.
Implementation of .
Stefan Makswit
17.02.2006
Property values are Strings by default
root of the metadata tree
the xpacket processing instructions content
Constructor for an empty metadata object.
Constructor for a cloned metadata tree.
an prefilled metadata tree which fulfills all
XMPNode contracts.
Returns a property, but the result value can be requested.
Returns a property, but the result value can be requested.
a schema namespace
a property name or path
the type of the value, see VALUE_...
Returns an XMPProperty
Collects any exception that occurs.
Combines the two ported classes XmpProperty407 and XmpProperty682
"407" and "682" were the line numbers in XMPMetaImpl.java of the Adobe Java 5.1.2 source file
These classes were anonymous, and that is unnecessary here
Returns a property, but the result value can be requested.
a schema namespace
a property name or path
the type of the value, see VALUE_...
Returns the node value as an object according to the
valueType.
Collects any exception that occurs.
Sets the packetHeader attributes, only used by the parser.
the processing instruction content
Performs a deep clone of the XMPMeta-object
Returns the root node of the XMP tree.
Locate or create the item node and set the value.
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.
an array node
the index where to insert the item
the item value
the options for the new item
insert oder overwrite at index position?
The internals for setProperty() and related calls, used after the node is
found or created.
the newly created node
the node value, can be null
options for the new node, must not be null.
flag if the existing value is to be overwritten
thrown if options and value do not correspond
Evaluates a raw node value to the given value type, apply special
conversions for defined types in XMP.
an int indicating the value type
the node containing the value
Returns a literal value for the node.
This class replaces the ExpatAdapter.cpp and does the
XML-parsing and fixes the prefix.
After the parsing several normalisations are applied to the XMP tree.
Stefan Makswit
01.02.2006
Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
Thrown if parsing or normalisation fails.
Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
Thrown if parsing or normalisation fails.
Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
Thrown if parsing or normalisation fails.
Parses an XMP metadata object from a stream, including de-aliasing and normalisation.
Thrown if parsing or normalisation fails.
Parses an XMP metadata object from a XDocument, including de-aliasing and normalisation.
Thrown if parsing or normalisation fails.
Parses XML from a byte buffer,
fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally.
a byte buffer containing the XMP packet
the parsing options
Returns an XML DOM-Document.
Thrown when the parsing fails.
Parses XML from an ,
fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally.
an Stream
the parsing options
Returns an XML DOM-Document.
Thrown when the parsing fails.
Parses XML from a byte buffer,
fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally.
To improve the performance on legal files, it is first tried to parse normally,
while the character fixing is only done when the first pass fails.
a byte buffer containing the XMP packet
the parsing options
Returns an XML DOM-Document.
Thrown when the parsing fails.
Parses XML from a , fixing the illegal control character optionally.
a String containing the XMP packet
the parsing options
Returns an XML DOM-Document.
Thrown when the parsing fails.
Wraps parsing and I/O-exceptions into an XMPException.
Wraps parsing and I/O-exceptions into an XMPException.
Find the XML node that is the root of the XMP data tree.
Find the XML node that is the root of the XMP data tree. Generally this
will be an outer node, but it could be anywhere if a general XML document
is parsed (e.g. SVG). The XML parser counted all rdf:RDF and
pxmp:XMP_Packet nodes, and kept a pointer to the last one. If there is
more than one possible root use PickBestRoot to choose among them.
If there is a root node, try to extract the version of the previous XMP
toolkit.
Pick the first x:xmpmeta among multiple root candidates. If there aren't
any, pick the first bare rdf:RDF if that is allowed. The returned root is
the rdf:RDF child if an x:xmpmeta element was chosen. The search is
breadth first, so a higher level candidate is chosen over a lower level
one that was textually earlier in the serialized XML.
initially, the root of the xml document as a list
flag if the xmpmeta-tag is still required, might be set
initially to true, if the parse option "REQUIRE_XMP_META" is set
The result array that is filled during the recursive process.
Returns an array that contains the result or null.
The array contains:
- [0] - the rdf:RDF-node
- [1] - an object that is either XMP_RDF or XMP_PLAIN (the latter is deprecated)
- [2] - the body text of the xpacket-instruction.
A node in the internally XMP tree, which can be a schema node, a property node, an array node,
an array item, a struct node or a qualifier node (without '?').
Possible improvements:
1. The kind Node of node might be better represented by a class-hierarchy of different nodes.
2. The array type should be an enum
3. isImplicitNode should be removed completely and replaced by return values of fi.
4. hasLanguage, hasType should be automatically maintained by XMPNode
Stefan Makswit
21.02.2006
list of child nodes, lazy initialized
list of child node references for faster lookup. Only initialized when the original _children list exceeds 9 entries
list of qualifier of the node, lazy initialized
options describing the kind of the node
Creates an XMPNode with initial values.
the name of the node
the value of the node
the options of the node
Constructor for the node without value.
the name of the node
the options of the node
Resets the node.
Get the parent node.
Set internally by , and .
an index [1..size]
Returns the child with the requested index.
Adds a node as child to this node.
an XMPNode
Adds a node as child to this node.
the index of the node before which the new one is inserted.
Note: The node children are indexed from [1..size]!
An index of size + 1 appends a node.
an XMPNode
Replaces a node with another one.
the index of the node that will be replaced.
Note: The node children are indexed from [1..size]!
the replacement XMPNode
Removes a child at the requested index.
the index to remove [1..size]
Removes a child node.
Removes a child node.
If its a schema node and doesn't have any children anymore, its deleted.
the child node to delete.
Removes the children list if this node has no children anymore;
checks if the provided node is a schema node and doesn't have any children anymore,
its deleted.
Removes all children from the node.
Returns the number of children without necessarily creating a list.
child node name to look for
Returns an XMPNode if node has been found, null otherwise.
an index [1..size]
Returns the qualifier with the requested index.
Returns the number of qualifier without necessarily creating a list.
Appends a qualifier to the qualifier list and sets respective options.
a qualifier node.
Removes one qualifier node and fixes the options.
qualifier to remove
Removes all qualifiers from the node and sets the options appropriate.
qualifier node name to look for
Returns a qualifier XMPNode if node has been found,
null otherwise.
Get whether the node has children.
Returns an iterator for the children.
Note: take care to use it.remove(), as the flag are not adjusted in that case.
Returns whether the node has qualifier attached.
Returns an iterator for the qualifier.
Note: take care to use it.remove(), as the flag are not adjusted in that case.
Iterator that disallows removal.
Performs a deep clone of the node and the complete subtree.
Performs a deep clone of the node and the complete subtree.
if skipEmpty is true, it will not clone node which has empty child and empty value.
If true, it will not clone those nodes with empty value and empty children
Performs a deep clone of the complete subtree (children and
qualifier )into and add it to the destination node.
if skipEmpty is true, it will not clone node which has empty child and empty value.
the node to add the cloned subtree
If true, it will not clone those nodes with empty value and empty children
Renders this node and the tree under this node in a human readable form.
Flag is qualifier and child nodes shall be rendered too
Returns a multiline string containing the dump.
Get and set the implicit node flag.
Get and set whether the node contains aliases (applies only to schema nodes).
Get and set whether this node is an alias (applies only to schema nodes).
Get and set whether this node has an rdf:value child node.
Sorts the XMP node and its children, recursively.
Sorting occurs according to the following rules:
- Nodes at one level are sorted by name, that is prefix + local name
- Starting at the root node the children and qualifier are sorted recursively,
which the following exceptions.
- Sorting will not be used for arrays.
- Within qualifier "xml:lang" and/or "rdf:type" stay at the top in that order,
all others are sorted.
Dumps this node and its qualifier and children recursively.
Dumps this node and its qualifier and children recursively.
Note: It creates empty options on every node.
FfF: sort schemas and properties on each level if and only if it would increase performance
the buffer to append the dump.
Flag is qualifier and child nodes shall be rendered too
the current indent level.
the index within the parent node (important for arrays)
Get whether this node is a language qualifier.
Get whether this node is a type qualifier.
Note: This method should always be called when accessing 'children' to be sure
that its initialized.
Returns list of children that is lazy initialized.
Returns a read-only copy of child nodes list.
Returns list of qualifier that is lazy initialized.
Internal find.
the list to search in
the search expression
Returns the found node or nulls.
Internal child find.
the child list to search in
the child dictionary ref to initialize or search. Needs to be a ref parameter or it won't update the original Dictionary
the search expression
Returns the found node or null.
Checks that a node name is not existing on the same level, except for array items.
the node name to check
Thrown if a node with the same name is existing.
Checks that a qualifier name is not existing on the same level.
the new qualifier name
Thrown if a node with the same name is existing.
Utilities for XMPNode.
Stefan Makswit
Aug 28, 2006
Find or create a schema node if createNodes is false and
the root of the xmp tree.
a namespace
a flag indicating if the node shall be created if not found.
Note: The namespace must be registered prior to this call.
Returns the schema node if found, null otherwise.
Note: If createNodes is true, it is always
returned a valid node.
An exception is only thrown if an error occurred, not if a
node was not found.
Find or create a schema node if createNodes is true.
the root of the xmp tree.
a namespace
If a prefix is suggested, the namespace is allowed to be registered.
a flag indicating if the node shall be created if not found.
Note: The namespace must be registered prior to this call.
Returns the schema node if found, null otherwise.
Note: If createNodes is true, it is always
returned a valid node.
An exception is only thrown if an error occurred, not if a
node was not found.
Find or create a child node under a given parent node.
Find or create a child node under a given parent node. If the parent node is no
Returns the found or created child node.
the parent node
the node name to find
flag, if new nodes shall be created.
Returns the found or created node or null.
Thrown if
Follow an expanded path expression to find or create a node.
the node to begin the search.
the complete xpath
flag if nodes shall be created
(when called by setProperty())
the options for the created leaf nodes (only when
createNodes == true).
Returns the node if found or created or null.
An exception is only thrown if an error occurred,
not if a node was not found.
Deletes the the given node and its children from its parent.
Deletes the the given node and its children from its parent.
Takes care about adjusting the flags.
FfF: think about moving is to XMPNode... (make removeChild/Qualifier private and
FfF: publish just deleteNode(XMPNode)
the top-most node to delete.
This is setting the value of a leaf node.
an XMPNode
a value
Verifies the PropertyOptions for consistency and updates them as needed.
Verifies the PropertyOptions for consistency and updates them as needed.
If options are null they are created with default values.
FfF: add an kind of autofix options to PropertyOptions and remove this method!!!
the PropertyOptions
the node value to set
Returns the updated options.
If the options are not consistant.
Converts the node value to string, apply special conversions for defined
types in XMP.
the node value to set
Returns the String representation of the node value.
After processing by ExpandXPath, a step can be of these forms:
After processing by ExpandXPath, a step can be of these forms:
- qualName - A top level property or struct field.
- [index] - An element of an array.
- [last()] - The last element of an array.
- [qualName="value"] - An element in an array of structs, chosen by a field value.
- [?qualName="value"] - An element in an array, chosen by a qualifier value.
- ?qualName - A general qualifier.
Find the appropriate child node, resolving aliases, and optionally creating nodes.
the node to start to start from
the xpath segment
returns the found or created node
Find or create a qualifier node under a given parent node.
Find or create a qualifier node under a given parent node. Returns a pointer to the
qualifier node, and optionally an iterator for the node's position in
the parent's vector of qualifiers. The iterator is unchanged if no qualifier node (null)
is returned.
Note: On entry, the qualName parameter must not have the leading '?' from the
step.
the parent XMPNode
the qualifier name
flag if nodes shall be created
Returns the qualifier node if found or created, null otherwise.
an array node
the segment containing the array index
flag if new nodes are allowed to be created.
Returns the index or index = -1 if not found
Throws Exceptions
Searches for a field selector in a node:
[fieldName="value] - an element in an array of structs, chosen by a field value.
Searches for a field selector in a node:
[fieldName="value] - an element in an array of structs, chosen by a field value.
No implicit nodes are created by field selectors.
Returns the index of the field if found, otherwise -1.
Searches for a qualifier selector in a node:
[?qualName="value"] - an element in an array, chosen by a qualifier value.
Searches for a qualifier selector in a node:
[?qualName="value"] - an element in an array, chosen by a qualifier value.
No implicit nodes are created for qualifier selectors,
except for an alias to an x-default item.
an array node
the qualifier name
the qualifier value
in case the qual selector results from an alias,
an x-default node is created if there has not been one.
Returns the index of th
Make sure the x-default item is first.
Make sure the x-default item is first. Touch up "single value"
arrays that have a default plus one real language. This case should have
the same value for both items. Older Adobe apps were hardwired to only
use the "x-default" item, so we copy that value to the other
item.
an alt text array node
See if an array is an alt-text array.
See if an array is an alt-text array. If so, make sure the x-default item
is first.
the array node to check if its an alt-text array
Appends a language item to an alt text array.
the language array
the language of the item
the content of the item
Thrown if a duplicate property is added
- Look for an exact match with the specific language.
- If a generic language is given, look for partial matches.
- Look for an "x-default"-item.
- Choose the first item.
the alt text array node
the generic language
the specific language
Returns the kind of match as an Integer and the found node in an
array.
Looks for the appropriate language item in a text alternative array.item
an array node
the requested language
Returns the index if the language has been found, -1 otherwise.
Stefan Makswit
Aug 18, 2006
caches the correct dc-property array forms
Normalizes a raw parsed XMPMeta-Object
the raw metadata object
the parsing options
Returns the normalized metadata object
Collects all severe processing errors.
Tweak old XMP: Move an instance ID from rdf:about to the
xmpMM:InstanceID property.
Tweak old XMP: Move an instance ID from rdf:about to the
xmpMM:InstanceID property. An old instance ID usually looks
like "uuid:bac965c4-9d87-11d9-9a30-000d936b79c4", plus InDesign
3.0 wrote them like "bac965c4-9d87-11d9-9a30-000d936b79c4". If
the name looks like a UUID simply move it to xmpMM:InstanceID,
don't worry about any existing xmpMM:InstanceID. Both will
only be present when a newer file with the xmpMM:InstanceID
property is updated by an old app that uses rdf:about.
the root of the metadata tree
Thrown if tweaking fails.
Visit all schemas to do general fixes and handle special cases.
the metadata object implementation
Thrown if the normalisation fails.
Undo the denormalization performed by the XMP used in Acrobat 5.
If a Dublin Core array had only one item, it was serialized as a simple
property.
The xml:lang attribute was dropped from an
alt-text item if the language was x-default.
the DC schema node
Thrown if normalization fails
Make sure that the array is well-formed AltText.
Make sure that the array is well-formed AltText. Each item must be simple
and have an "xml:lang" qualifier. If repairs are needed, keep simple
non-empty items by adding the "xml:lang" with value "x-repair".
the property node of the array to repair.
Forwards unexpected exceptions.
Visit all of the top level nodes looking for aliases.
Visit all of the top level nodes looking for aliases. If there is
no base, transplant the alias subtree. If there is a base and strict
aliasing is on, make sure the alias and base subtrees match.
the root of the metadata tree
th parsing options
Forwards XMP errors
Moves an alias node of array form to another schema into an array
the property iterator of the old schema (used to delete the property)
the node to be moved
the base array for the array item
Forwards XMP errors
Fixes the GPS Timestamp in EXIF.
the EXIF schema node
Thrown if the date conversion fails.
Remove all empty schemas from the metadata tree that were generated during the rdf parsing.
the root of the metadata tree
The outermost call is special.
The outermost call is special. The names almost certainly differ. The
qualifiers (and hence options) will differ for an alias to the x-default
item of a langAlt array.
the alias node
the base node of the alias
marks the outer call of the recursion
Forwards XMP errors
The initial support for WAV files mapped a legacy ID3 audio copyright
into a new xmpDM:copyright property.
The initial support for WAV files mapped a legacy ID3 audio copyright
into a new xmpDM:copyright property. This is special case code to migrate
that into dc:rights['x-default']. The rules:
-
If there is no dc:rights array, or an empty array -
Create one with dc:rights['x-default'] set from double linefeed and xmpDM:copyright.
-
If there is a dc:rights array but it has no x-default item -
Create an x-default item as a copy of the first item then apply rule #3.
-
If there is a dc:rights array with an x-default item,
Look for a double linefeed in the value.
- If no double linefeed, compare the x-default value to the xmpDM:copyright value.
- If they match then leave the x-default value alone.
- Otherwise, append a double linefeed and the xmpDM:copyright value to the x-default value.
- If there is a double linefeed, compare the trailing text to the xmpDM:copyright value.
- If they match then leave the x-default value alone.
- Otherwise, replace the trailing x-default text with the xmpDM:copyright value.
- In all cases, delete the xmpDM:copyright property.
the metadata object
the "dm:copyright"-property
The schema registry handles the namespaces, aliases and global options for the XMP Toolkit.
There is only one singleton instance used by the toolkit, accessed via .
Stefan Makswit
27.01.2006
a map from a namespace URI to its registered prefix.
a map from a prefix to the associated namespace URI.
A map of all registered aliases, from qname to IXmpAliasInfo.
The pattern that must not be contained in simple properties
Performs the initialisation of the registry with the default namespaces, aliases and global
options.
Register the standard namespaces of schemas and types that are included in the XMP
Specification and some other Adobe private namespaces.
Register the standard namespaces of schemas and types that are included in the XMP
Specification and some other Adobe private namespaces.
Note: This method is not lock because only called by the constructor.
Forwards processing exceptions
Associates an alias name with an actual name.
Associates an alias name with an actual name.
Define a alias mapping from one namespace/property to another. Both
property names must be simple names. An alias can be a direct mapping,
where the alias and actual have the same data type. It is also possible
to map a simple alias to an item in an array. This can either be to the
first item in the array, or to the 'x-default' item in an alt-text array.
Multiple alias names may map to the same actual, as long as the forms
match. It is a no-op to reregister an alias in an identical fashion.
Note: This method is not locking because only called by registerStandardAliases
which is only called by the constructor.
Note2: The method is only package-private so that it can be tested with unittests
The namespace URI for the alias. Must not be null or the empty string.
The name of the alias. Must be a simple name, not null or the empty string and not a general path expression.
The namespace URI for the actual. Must not be null or the empty string.
The name of the actual. Must be a simple name, not null or the empty string and not a general path expression.
Provides options for aliases for simple aliases to array items. This is needed to know what kind of array to create if
set for the first time via the simple alias. Pass XMP_NoOptions, the default value, for all direct aliases regardless of whether the actual
data type is an array or not (see ).
for inconsistant aliases.
Serializes the XMPMeta-object to an OutputStream according to the
SerializeOptions.
Stefan Makswit
11.07.2006
Static method to serialize the metadata object.
For each serialisation, a new XMPSerializer
instance is created, either XMPSerializerRDF or XMPSerializerPlain so that its possible to
serialize the same XMPMeta objects in two threads.
a metadata implementation object
the output stream to serialize to
serialization options, can be null for default.
Serializes an XMPMeta-object as RDF into a string.
Note: Encoding is forced to UTF-16 when serializing to a
string to ensure the correctness of "exact packet size".
a metadata implementation object
Options to control the serialization (see ).
Returns a string containing the serialized RDF.
on serialization errors.
Serializes an XMPMeta-object as RDF into a byte buffer.
a metadata implementation object
Options to control the serialization (see ).
Returns a byte buffer containing the serialized RDF.
on serialization errors.
Serializes the XMPMeta-object using the standard RDF serialization format.
Serializes the XMPMeta-object using the standard RDF serialization format.
The output is written to an OutputStream
according to the SerializeOptions.
FfF: Move to XMLStreamWriter (a lot of test would break due to slight format change).
Stefan Makswit
11.07.2006
default padding
The w/r is missing inbetween
a set of all rdf attribute qualifier
the metadata object to be serialized.
the output stream to serialize to
this writer is used to do the actual serialization
the stored serialization options
the size of one unicode char, for UTF-8 set to 1
(Note: only valid for ASCII chars lower than 0x80),
set to 2 in case of UTF-16
the padding in the XMP Packet, or the length of the complete packet in
case of option exactPacketLength.
The actual serialization.
the metadata object to be serialized
outputStream the output stream to serialize to
the serialization options
If case of wrong options or any other serialization error.
Calculates the padding according to the options and write it to the stream.
the length of the tail string
thrown if packet size is to small to fit the padding
forwards writer errors
Checks if the supplied options are consistent.
Thrown if options are conflicting
Writes the (optional) packet header and the outer rdf-tags.
Returns the packet end processing instraction to be written after the padding.
Forwarded writer exceptions.
Serializes the metadata in pretty-printed manner.
indent level
Forwarded writer exceptions
Serializes the metadata in compact manner.
indent level to start with
Forwarded writer exceptions
Write each of the parent's simple unqualified properties as an attribute.
Write each of the parent's simple unqualified properties as an attribute. Returns true if all
of the properties are written as attributes.
the parent property node
the current indent level
Returns true if all properties can be rendered as RDF attribute.
Recursively handles the "value" for a node that must be written as an RDF
property element.
Recursively handles the "value" for a node that must be written as an RDF
property element. It does not matter if it is a top level property, a
field of a struct, or an item of an array. The indent is that for the
property element. The patterns below ignore attribute qualifiers such as
xml:lang, they don't affect the output form.
<ns:UnqualifiedStructProperty-1
... The fields as attributes, if all are simple and unqualified
/>
<ns:UnqualifiedStructProperty-2 rdf:parseType="Resource">
... The fields as elements, if none are simple and unqualified
</ns:UnqualifiedStructProperty-2>
<ns:UnqualifiedStructProperty-3>
<rdf:Description
... The simple and unqualified fields as attributes
>
... The compound or qualified fields as elements
</rdf:Description>
</ns:UnqualifiedStructProperty-3>
<ns:UnqualifiedArrayProperty>
<rdf:Bag> or Seq or Alt
... Array items as rdf:li elements, same forms as top level properties
</rdf:Bag>
</ns:UnqualifiedArrayProperty>
<ns:QualifiedProperty rdf:parseType="Resource">
<rdf:value> ... Property "value"
following the unqualified forms ... </rdf:value>
... Qualifiers looking like named struct fields
</ns:QualifiedProperty>
*** Consider numbered array items, but has compatibility problems.
Consider qualified form with rdf:Description and attributes.
the parent node
the current indent level
Forwards writer exceptions
If qualifier and element fields are mixed.
Serializes a simple property.
an XMPNode
Returns an array containing the flags emitEndTag and indentEndTag.
Forwards the writer exceptions.
Serializes an array property.
an XMPNode
the current indent level
Forwards the writer exceptions.
If qualifier and element fields are mixed.
Serializes a struct property.
an XMPNode
the current indent level
Flag if the element has resource qualifier
Returns true if an end flag shall be emitted.
Forwards the writer exceptions.
If qualifier and element fields are mixed.
Serializes the general qualifier.
the root node of the subtree
the current indent level
Forwards all writer exceptions.
If qualifier and element fields are mixed.
Serializes one schema with all contained properties in pretty-printed manner.
Each schema's properties are written to a single
rdf:Description element. All of the necessary namespaces are declared in
the rdf:Description element. The baseIndent is the base level for the
entire serialization, that of the x:xmpmeta element. An xml:lang
qualifier is written as an attribute of the property start tag, not by
itself forcing the qualified property form.
<rdf:Description rdf:about="TreeName" xmlns:ns="URI" ... >
... The actual properties of the schema, see SerializePrettyRDFProperty
<!-- ns1:Alias is aliased to ns2:Actual --> ... If alias comments are wanted
</rdf:Description>
a schema node
Forwarded writer exceptions
Writes all used namespaces of the subtree in node to the output.
Writes all used namespaces of the subtree in node to the output.
The subtree is recursively traversed.
the root node of the subtree
a set containing currently used prefixes
the current indent level
Forwards all writer exceptions.
Writes one namespace declaration to the output.
a namespace prefix (without colon) or a complete qname (when namespace == null)
the a namespace
a set containing currently used prefixes
the current indent level
Forwards all writer exceptions.
Start the outer rdf:Description element, including all needed xmlns attributes.
Start the outer rdf:Description element, including all needed xmlns attributes.
Leave the element open so that the compact form can add property attributes.
If the writing to
Write the </rdf:Description> end tag.
Recursively handles the "value" for a node.
Recursively handles the "value" for a node. It does not matter if it is a
top level property, a field of a struct, or an item of an array. The
indent is that for the property element. An xml:lang qualifier is written
as an attribute of the property start tag, not by itself forcing the
qualified property form. The patterns below mostly ignore attribute
qualifiers like xml:lang. Except for the one struct case, attribute
qualifiers don't affect the output form.
<ns:UnqualifiedSimpleProperty>value</ns:UnqualifiedSimpleProperty>
<ns:UnqualifiedStructProperty> (If no rdf:resource qualifier)
<rdf:Description>
... Fields, same forms as top level properties
</rdf:Description>
</ns:UnqualifiedStructProperty>
<ns:ResourceStructProperty rdf:resource="URI"
... Fields as attributes
>
<ns:UnqualifiedArrayProperty>
<rdf:Bag> or Seq or Alt
... Array items as rdf:li elements, same forms as top level properties
</rdf:Bag>
</ns:UnqualifiedArrayProperty>
<ns:QualifiedProperty>
<rdf:Description>
<rdf:value> ... Property "value" following the unqualified
forms ... </rdf:value>
... Qualifiers looking like named struct fields
</rdf:Description>
</ns:QualifiedProperty>
the property node
property shall be rendered as attribute rather than tag
use canonical form with inner description tag or
the compact form with rdf:ParseType="resource" attribute.
the current indent level
Forwards all writer exceptions.
If "rdf:resource" and general qualifiers are mixed.
Writes the array start and end tags.
an array node
flag if its the start or end tag
the current indent level
forwards writer exceptions
Serializes the node value in XML encoding.
Serializes the node value in XML encoding. Its used for tag bodies and
attributes. Note: The attribute is always limited by quotes,
thats why ' is never serialized. Note:
Control chars are written unescaped, but if the user uses others than tab, LF
and CR the resulting XML will become invalid.
the value of the node
flag if value is an attribute value
A node can be serialized as RDF-Attribute, if it meets the following conditions:
- is not array item
- don't has qualifier
- is no URI
- is no composite property
an XMPNode
Returns true if the node serialized as RDF-Attribute
Writes indents and automatically includes the base indent from the options.
number of indents to write
forwards exception
Writes an int to the output.
an int
forwards writer exceptions
Writes a char to the output.
a char
forwards writer exceptions
Writes a String to the output.
a String
forwards writer exceptions
Writes an amount of chars, mostly spaces
number of chars
a char
Writes a newline according to the options.
Forwards exception
Stefan Makswit
11.08.2006
The XMP object containing the array to be catenated.
The schema namespace URI for the array. Must not be null or
the empty string.
The name of the array. May be a general path expression, must
not be null or the empty string. Each item in the array must
be a simple string value.
The string to be used to separate the items in the catenated
string. Defaults to "; ", ASCII semicolon and space
(U+003B, U+0020).
The characters to be used as quotes around array items that
contain a separator. Defaults to '"'
Option flag to control the catenation.
Returns the string containing the catenated array items.
Forwards the Exceptions from the metadata processing
See .
The XMP object containing the array to be updated.
The schema namespace URI for the array. Must not be null or the empty string.
The name of the array. May be a general path expression, must
not be null or the empty string. Each item in the array must
be a simple string value.
The string to be separated into the array items.
Option flags to control the separation.
Flag if commas shall be preserved
Forwards the Exceptions from the metadata processing
Utility to find or create the array used by separateArrayItems().
a the namespace fo the array
the name of the array
the options for the array if newly created
the xmp object
Returns the array node.
Forwards exceptions
The XMP object containing the properties to be removed.
Optional schema namespace URI for the properties to be
removed.
Optional path expression for the property to be removed.
Option flag to control the deletion: do internal properties in
addition to external properties.
Option flag to control the deletion: Include aliases in the
"named schema" case above.
If metadata processing fails
The source XMP object.
The destination XMP object.
Do internal properties in addition to external properties.
Replace the values of existing properties.
Delete destination values if source property is empty.
Forwards the Exceptions from the metadata processing
Remove all schema children according to the flag doAllProperties.
Empty schemas are automatically remove by XMPNode.
a schema node
flag if all properties or only externals shall be removed.
Returns true if the schema is empty after the operation.
The destination XMP object.
the source node
the parent of the destination node
Replace the values of existing properties.
flag if properties with empty values should be deleted in the destination object.
Compares two nodes including its children and qualifier.
an XMPNode
an XMPNode
Returns true if the nodes are equal, false otherwise.
Forwards exceptions to the calling method.
Make sure the separator is OK.
Separators must be one semicolon surrounded by zero or more spaces. Any of the recognized semicolons or spaces are allowed.
Make sure the open and close quotes are a legitimate pair and return the
correct closing quote or an exception.
opened and closing quote in a string
the open quote
Returns a corresponding closing quote.
Classifies the character into normal chars, spaces, semicola, quotes,
control chars.
a char
Return the character kind.
the open quote char
Returns the matching closing quote for an open quote.
Add quotes to the item.
the array item
the open quote character
the closing quote character
flag if commas are allowed
Returns the value in quotes.
a character
the opening quote char
the closing quote char
Return it the character is a surrounding quote.
a character
the opening quote char
the closing quote char
Returns true if the character is a closing quote.
- U+0022 ASCII space
- U+3000, ideographic space
- U+303F, ideographic half fill space
- U+2000..U+200B, en quad through zero width space
- U+002C, ASCII comma
- U+FF0C, full width comma
- U+FF64, half width ideographic comma
- U+FE50, small comma
- U+FE51, small ideographic comma
- U+3001, ideographic comma
- U+060C, Arabic comma
- U+055D, Armenian comma
- U+003B, ASCII semicolon
- U+FF1B, full width semicolon
- U+FE54, small semicolon
- U+061B, Arabic semicolon
- U+037E, Greek "semicolon" (really a question mark)
- U+0022 ASCII quote
- U+00AB and U+00BB, guillemet quotes
- U+3008..U+300F, various quotes
- U+301D..U+301F, double prime quotes
- U+2015, dash quote
- U+2018..U+201F, various quotes
- U+2039 and U+203A, guillemet quotes
The square brackets are not interpreted as quotes anymore (bug #2674672)
(ASCII '[' (0x5B) and ']' (0x5D) are used as quotes in Chinese and
Korean.)
- U+0000..U+001F ASCII controls
- U+2028, line separator
- U+2029, paragraph separator
Moves the specified Property from one Meta to another.
Meta Object from where the property needs to move
Meta Object to where the property needs to move
Schema of the specified property
Name of the property
true in case of success otherwise false.
estimates the size of an xmp node
XMP Node Object
the estimated size of the node
Utility function for placing objects in a Map. It behaves like a multi map.
A Map object which takes int as a key and list of list of string as value
A key for the map
A value for the map
Utility function for retrieving biggest entry in the multimap
see EstimateSizeForJPEG for size calculation
A Map object which takes int as a key and list of list of string as value
the list with the maximum size.
Utility function for creating esimated size map for different properties of XMP Packet.
see PackageForJPEG
Meta Object whose property sizes needs to calculate.
A treeMap Object which takes int as a key and list of list of string as values
Utility function for moving the largest property from One XMP Packet to another.
see MoveOneProperty and PackageForJPEG
Meta Object from where property moves.
Meta Object to where property moves.
A treeMap Object which holds the estimated sizes of the property of stdXMP as a key and their string representation as map values.
creates XMP serializations appropriate for a JPEG file.
The standard XMP in a JPEG file is limited to 64K bytes. This function
serializes the XMP metadata in an XMP object into a string of RDF.If
the data does not fit into the 64K byte limit, it creates a second packet
string with the extended data.
The XMP object containing the metadata.
A string object in which to return the full standard XMP packet.
A string object in which to return the serialized extended XMP, empty if not needed.
A string object in which to return an MD5 digest of the serialized extended XMP, empty if not needed.
merges standard and extended XMP retrieved from a JPEG file.
When an extended partition stores properties that do not fit into the
JPEG file limitation of 64K bytes, this function integrates those
properties back into the same XMP object with those from the standard XMP
packet.
An XMP object which the caller has initialized from the standard XMP packet in a JPEG file. The extended XMP is added to this object.
An XMP object which the caller has initialized from the extended XMP packet in a JPEG file.
modifies a working XMP object according to a template object.
The XMP template can be used to add, replace or delete properties from
the working XMP object. The actions that you specify determine how the
template is applied.Each action can be applied individually or combined;
if you do not specify any actions, the properties and values in the
working XMP object do not change.
The destination XMP object.
The template to apply to the destination XMP object.
Option flags to control the copying. If none are specified,
the properties and values in the working XMP do not change. A logical OR of these bit-flag constants:
CLEAR_UNNAMED_PROPERTIES Delete anything that is not in the template.
ADD_NEW_PROPERTIES Add properties; see detailed description.
REPLACE_EXISTING_PROPERTIES Replace the values of existing properties.
REPLACE_WITH_DELETE_EMPTY Replace the values of existing properties and delete properties if the new value is empty.
INCLUDE_INTERNAL_PROPERTIES Operate on internal properties as well as external properties.
Marks a struct field step, also for top level nodes (schema "fields").
Marks a qualifier step.
Marks a qualifier step.
Note: Order is significant to separate struct/qual from array kinds!
Marks an array index step
Represents an XMP XmpPath with segment accessor methods.
28.02.2006
stores the segments of an
Append a path segment
the segment to add
the index of the segment to return
Returns a path segment.
Returns the size of the xmp path.
Serializes the normalized XMP-path.
Parser for XMP XPaths.
01.03.2006
Split an expression apart at the conceptual steps, adding the
root namespace prefix to the first property component.
The schema URI is put in the first (0th) slot in the expanded .
Check if the top level component is an alias, but don't resolve it.
In the most verbose case steps are separated by '/', and each step can be
of these forms:
-
prefix:name
A top level property or struct field.
-
[index]
An element of an array.
-
[last()]
The last element of an array.
-
[fieldName="value"]
An element in an array of structs, chosen by a field value.
-
[@xml:lang="value"]
An element in an alt-text array, chosen by the xml:lang qualifier.
-
[?qualName="value"]
An element in an array, chosen by a qualifier value.
-
@xml:lang
An xml:lang qualifier.
-
?qualName
A general qualifier.
The logic is complicated though by shorthand for arrays, the separating
'/' and leading '*' are optional. These are all equivalent: array/*[2]
array/[2] array*[2] array[2] All of these are broken into the 2 steps
"array" and "[2]".
The value portion in the array selector forms is a string quoted by '''
or '"'. The value may contain any character including a doubled quoting
character. The value may be empty.
The syntax isn't checked, but an XML name begins with a letter or '_',
and contains letters, digits, '.', '-', '_', and a bunch of special
non-ASCII Unicode characters. An XML qualified name is a pair of names
separated by a colon.
schema namespace
property name
Returns the expanded .
Thrown if the format is not correct somehow.
Parses a struct segment
the current position in the path
The segment or an error
If the segment is empty
Parses an array index segment.
the xmp path
Returns the segment or an error
thrown on xmp path errors
Parses the root node of an XMP Path, checks if namespace and prefix fit together
and resolve the property to the base property if it is an alias.
the root namespace
the parsing position helper
the path to contribute to
If the path is not valid.
Verifies whether the qualifier name is not XML conformant or the
namespace prefix has not been registered.
a qualifier name
If the name is not conformant
Verify if an XML name is conformant.
an XML name
When the name is not XML conformant
Set up the first 2 components of the expanded .
Normalizes the various cases of using
the full schema URI and/or a qualified root property name. Returns true for normal
processing. If allowUnknownSchemaNS is true and the schema namespace is not registered, false
is returned. If allowUnknownSchemaNS is false and the schema namespace is not registered, an
exception is thrown
(Should someday check the full syntax:)
schema namespace
the root xpath segment
Returns root QName.
Thrown if the format is not correct somehow.
This objects contains all needed char positions to parse.
the complete path
the start of a segment name
the end of a segment name
the begin of a step
the end of a step
A segment of a parsed .
23.06.2006
Constructor with initial values.
the name of the segment
Constructor with initial values.
the name of the segment
the kind of the segment
Get and set the kind of the path segment.
Get and set the name of the path segment.
Get and set whether the segment is an alias.
Get and set the alias form, if this segment has been created by an alias.
This interface is used to return info about an alias.
Stefan Makswit
27.01.2006
Gets the namespace URI for the base property.
Gets the default prefix for the given base property.
Gets the path of the base property.
Gets the kind of the alias. This can be a direct alias
(ARRAY), a simple property to an ordered array
(ARRAY_ORDERED), to an alternate array
(ARRAY_ALTERNATE) or to an alternate text array
(ARRAY_ALT_TEXT).
The XMPDateTime-class represents a point in time up to a resolution of nanoseconds.
Dates and time in the serialized XMP are ISO 8601 strings. There are utility functions
to convert to the ISO format, a Calendar or get the Timezone. The fields of
XMPDateTime are:
- month - The month in the range 1..12.
- day - The day of the month in the range 1..31.
- minute - The minute in the range 0..59.
- hour - The time zone hour in the range 0..23.
- minute - The time zone minute in the range 0..59.
- nanosecond - The nanoseconds within a second. Note: if the XMPDateTime is
converted into a calendar, the resolution is reduced to milliseconds.
- timeZone - a TimeZone-object.
DateTime values are occasionally used in cases with only a date or only a time component. A date
without a time has zeros for all the time fields. A time without a date has zeros for all date
fields (year, month, and day).
Get and set the year value. Can be negative.
Get and set the month, within range 1..12.
Get and set the day of the month, within range 1..31.
Returns hour - The hour in the range 0..23.
Get and set the minute, within range 0..59.
Get and set the second, within range 0..59.
Get and set the sub-second period, in nanoseconds.
Get and set the time zone.
Get and set the offset, primarily for ISO8601 converter.
This flag is set either by parsing or by setting year, month or day.
Returns true if the XMPDateTime object has a date portion.
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.
Returns true if the XMPDateTime object has a time portion.
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.
Returns true if the XMPDateTime object has a defined timezone.
Returns a Calendar (only with millisecond precision).
Dates before Oct 15th 1585 (which normally fall into validity of
the Julian calendar) are also rendered internally as Gregorian dates.
Returns the ISO 8601 string representation of the date and time.
Interface for the XMPMeta iteration services.
XMPIterator provides a uniform means to iterate over the
schema and properties within an XMP object.
The iteration over the schema and properties within an XMP object is very
complex. It is helpful to have a thorough understanding of the XMP data tree.
One way to learn this is to create some complex XMP and examine the output of
XMPMeta#toString. This is also described in the XMP
Specification, in the XMP Data Model chapter.
The top of the XMP data tree is a single root node. This does not explicitly
appear in the dump and is never visited by an iterator (that is, it is never
returned from XMPIterator#next()). Beneath the root are
schema nodes. These are just collectors for top level properties in the same
namespace. They are created and destroyed implicitly. Beneath the schema
nodes are the property nodes. The nodes below a property node depend on its
type (simple, struct, or array) and whether it has qualifiers.
An XMPIterator is created by XMPMeta#iterator() constructor
defines a starting point for the iteration and options that control how it
proceeds. By default the iteration starts at the root and visits all nodes
beneath it in a depth first manner. The root node is not visited, the first
visited node is a schema node. You can provide a schema name or property path
to select a different starting node. By default this visits the named root
node first then all nodes beneath it in a depth first manner.
The XMPIterator#next() method delivers the schema URI, path,
and option flags for the node being visited. If the node is simple it also
delivers the value. Qualifiers for this node are visited next. The fields of
a struct or items of an array are visited after the qualifiers of the parent.
The options to control the iteration are:
- JUST_CHILDREN - Visit just the immediate children of the root. Skip
the root itself and all nodes below the immediate children. This omits the
qualifiers of the immediate children, the qualifier nodes being below what
they qualify, default is to visit the complete subtree.
- JUST_LEAFNODES - Visit just the leaf property nodes and their
qualifiers.
- JUST_LEAFNAME - Return just the leaf component of the node names.
The default is to return the full xmp path.
- OMIT_QUALIFIERS - Do not visit the qualifiers.
- INCLUDE_ALIASES - Adds known alias properties to the properties in the iteration.
Note: Not supported in Java or .NET XMPCore!
next() returns XMPPropertyInfo-objects and throws
a NoSuchElementException if there are no more properties to
return.
Stefan Makswit
25.01.2006
Skip the subtree below the current node when next() is
called.
Skip the subtree below and remaining siblings of the current node when
next() is called.
This class represents the set of XMP metadata as a DOM representation.
It has methods to read and modify all kinds of properties, create an iterator over all properties
and serialize the metadata to a string, byte array or stream.
Stefan Makswit
20.01.2006
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 or
null 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 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 .
The namespace URI for the property. May be null or the empty
string if the first component of the propName path contains a namespace prefix. The
URI must be for a registered namespace.
The name of the property. May be a general path expression, must not be
null 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 an containing the value and the options, or
null if the property does not exist.
Wraps all errors and exceptions that may occur.
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.
The namespace URI for the array. Has the same usage as in .
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
propName in .
The index of the desired item. Arrays in XMP are indexed from 1. The constant
always refers to the last existing array item.
Returns an containing the value and the options or
null if the property does not exist.
Wraps all errors and exceptions that may occur.
Returns the number of items in the array.
The namespace URI for the array. Has the same usage as in .
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
propName in .
Returns the number of items in the array.
Wraps all errors and exceptions that may occur.
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.
The namespace URI for the struct. Has the same usage as in .
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 .
The namespace URI for the field. Has the same URI and prefix usage as the
schemaNS parameter.
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.
Returns an containing the value and the options or
null if the property does not exist. Arrays and non-leaf levels of
structs do not have values.
Wraps all errors and exceptions that may occur.
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.
The namespace URI for the struct. Has the same usage as in .
The name of the property to which the qualifier is attached. May be a general
path expression, must not be null or the empty string. Has the same
namespace prefix usage as in .
The namespace URI for the qualifier. Has the same URI and prefix usage as the
schemaNS parameter.
The name of the qualifier. Must be a single XML name, must not be
null or the empty string. Has the same namespace prefix usage as the
propName parameter.
Returns an containing the value and the options of the
qualifier or null if the property does not exist. The name of the
qualifier must be a single XML name, must not be null 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).
Wraps all errors and exceptions that may occur.
The property value setters all take a property specification, their
differences are in the form of this.
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 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 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 .
The namespace URI for the property. Has the same usage as in .
The name of the property.
Has the same usage as in .
the value for the property (only leaf properties have a value).
Arrays and non-leaf levels of structs do not have values.
Must be null if the value is not relevant.
The value is automatically detected: Boolean, Integer, Long, Double, and
byte[] are handled, on all other is called.
Option flags describing the property. See the earlier description.
Wraps all errors and exceptions that may occur.
The namespace URI
The name of the property
the value for the property
Wraps all errors and exceptions
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.
The namespace URI for the array. Has the same usage as in .
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
propName in .
The index of the desired item. Arrays in XMP are indexed from 1. To address
the last existing item, use
to find
out the length of the array.
the new value of the array item. Has the same usage as propValue in
.
the set options for the item.
Wraps all errors and exceptions that may occur.
The namespace URI
The name of the array
The index to insert the new item
the new value of the array item
Wraps all errors and exceptions
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.
The namespace URI for the array. Has the same usage as in .
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
propName in .
The index to insert the new item. Arrays in XMP are indexed from 1. Use
to append items.
the new value of the array item. Has the same usage as
propValue in .
the set options that decide about the kind of the node.
Wraps all errors and exceptions that may occur.
The namespace URI for the array
The name of the array
The index to insert the new item
the value of the array item
Wraps all errors and exceptions
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.
The namespace URI for the array. Has the same usage as in .
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 .
Option flags describing the array form. The only valid options are
- ,
- ,
- or
- .
Note: the array options only need to be provided if the array is not
already existing, otherwise you can set them to null or use
.
the value of the array item. Has the same usage as propValue in .
Option flags describing the item to append ()
Wraps all errors and exceptions that may occur.
The namespace URI for the array
The name of the array
the value of the array item
Wraps all errors and exceptions
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.
The namespace URI for the struct. Has the same usage as in .
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 .
The namespace URI for the field. Has the same URI and prefix usage as the
schemaNS parameter.
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.
the value of thefield, if the field has a value.
Has the same usage as propValue in .
Option flags describing the field. See the earlier description.
Wraps all errors and exceptions that may occur.
The namespace URI for the struct
The name of the struct
The namespace URI for the field
The name of the field
the value of the field
Wraps all errors and exceptions
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.
The namespace URI for the struct. Has the same usage as in .
The name of the property to which the qualifier is attached. Has the same usage as in .
The namespace URI for the qualifier. Has the same URI and prefix usage as the schemaNS parameter.
The name of the qualifier. Must be a single XML name, must not be
null or the empty string. Has the same namespace prefix usage as the
propName parameter.
A pointer to the null terminated UTF-8 string that is the
value of the qualifier, if the qualifier has a value. Has the same usage as propValue
in .
Option flags describing the qualifier. See the earlier description.
Wraps all errors and exceptions that may occur.
The namespace URI for the struct
The name of the property to which the qualifier is attached
The namespace URI for the qualifier
The name of the qualifier
the value of the qualifier
Wraps all errors and exceptions
Deletes the given XMP subtree rooted at the given property.
It is not an error if the property does not exist.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Deletes the given XMP subtree rooted at the given array item.
It is not an error if the array item does not exist.
The namespace URI for the array. Has the same usage as in .
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
propName in .
The index of the desired item. Arrays in XMP are indexed from 1. The
constant always refers to the last
existing array item.
Deletes the given XMP subtree rooted at the given struct field.
It is not an error if the field does not exist.
The namespace URI for the struct. Has the same usage as in .
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 .
The namespace URI for the field. Has the same URI and prefix usage as the schemaNS parameter.
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.
Deletes the given XMP subtree rooted at the given qualifier.
Deletes the given XMP subtree rooted at the given qualifier. It is not an error if the
qualifier does not exist.
The namespace URI for the struct. Has the same usage as in .
The name of the property to which the qualifier is attached. Has the same usage as in .
The namespace URI for the qualifier. Has the same URI and prefix usage as the schemaNS parameter.
The name of the qualifier. Must be a single XML name, must not be
null or the empty string. Has the same namespace prefix usage as the
propName parameter.
Returns whether the property exists.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns true if the property exists.
Tells if the array item exists.
The namespace URI for the array. Has the same usage as in .
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
propName in .
The index of the desired item. Arrays in XMP are indexed from 1. The
constant always refers to the last
existing array item.
Returns true if the array exists, false otherwise.
DoesStructFieldExist tells if the struct field exists.
The namespace URI for the struct. Has the same usage as in .
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 .
The namespace URI for the field. Has the same URI and prefix usage as the schemaNS parameter.
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.
Returns true if the field exists.
DoesQualifierExist tells if the qualifier exists.
The namespace URI for the struct. Has the same usage as in .
The name of the property to which the qualifier is attached. Has the same usage as in .
The namespace URI for the qualifier. Has the same URI and prefix usage as the schemaNS parameter.
The name of the qualifier. Must be a single XML name, must not be
null or the empty string. Has the same namespace prefix usage as the
propName parameter.
Returns true if the qualifier exists.
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.
The XMP toolkit normalizes alt-text arrays such that the x-default item is the first item.
The SetLocalizedText function has several special features related to the x-default item, see
its description for details. The selection of the array item is the same for GetLocalizedText
and SetLocalizedText:
- 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.
A partial match with the generic language is where the start of the item's language matches
the generic string and the next character is '-'. An exact match is also recognized as a
degenerate case. It is fine to pass x-default as the specific language. In this case,
selection of an x-default item is an exact match by the first rule, not a selection by the
3rd rule. The last 2 rules are fallbacks used when the specific and generic languages fail to
produce a match. getLocalizedText returns information about a selected item in
an alt-text array. The array item is selected according to the rules given above.
The namespace URI for the alt-text array. Has the same usage as in
.
The name of the alt-text array. May be a general path expression, must not
be null or the empty string. Has the same namespace prefix usage as
propName in .
The name of the generic language as an RFC 3066 primary subtag. May be
null or the empty string if no generic language is wanted.
The name of the specific language as an RFC 3066 tag. Must not be
null or the empty string.
Returns an containing the value, the actual language and
the options if an appropriate alternate collection item exists, null
if the property.
does not exist.
Wraps all errors and exceptions that may occur.
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.
The namespace URI for the alt-text array. Has the same usage as in
.
The name of the alt-text array. May be a general path expression, must not
be null or the empty string. Has the same namespace prefix usage as
propName in .
The name of the generic language as an RFC 3066 primary subtag. May be
null or the empty string if no generic language is wanted.
The name of the specific language as an RFC 3066 tag. Must not be
null or the empty string.
A pointer to the null terminated UTF-8 string that is the new
value for the appropriate array item.
Option flags, none are defined at present.
Wraps all errors and exceptions that may occur.
The namespace URI for the alt-text array
The name of the alt-text array
The name of the generic language
The name of the specific language
the new value for the appropriate array item
Wraps all errors and exceptions
These are very similar to and above,
but the value is returned or provided in a literal form instead of as a UTF-8 string.
The path composition functions in may be used to compose an path
expression for fields in nested structures, items in arrays, or qualifiers.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns a bool value or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns an int value or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns a long value or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns a double value or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns a IXmpDateTime object or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns a Calendar-object or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to retrieve the literal value of a property.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns a byte[]-array contained the decoded base64 value or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to retrieve the literal value of a property.
Note that there is no setPropertyString()z, because sets a string value.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
Returns a string value or null if the property does not exist.
Wraps all exceptions that may occur, especially conversion errors.
Convenience method to set a property to a literal boolean value.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
the literal property value as boolean.
options of the property to set (optional).
Wraps all exceptions that may occur.
The namespace URI for the property
The name of the property
the literal property value as boolean
Wraps all exceptions
Convenience method to set a property to a literal int value.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
the literal property value as int.
options of the property to set (optional).
Wraps all exceptions that may occur.
The namespace URI for the property
The name of the property
the literal property value as int
Wraps all exceptions
Convenience method to set a property to a literal long value.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
the literal property value as long.
options of the property to set (optional).
Wraps all exceptions that may occur.
The namespace URI for the property
The name of the property
the literal property value as long
Wraps all exceptions
Convenience method to set a property to a literal double value.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
the literal property value as double.
options of the property to set (optional).
Wraps all exceptions that may occur.
The namespace URI for the property
The name of the property
the literal property value as double
Wraps all exceptions
Convenience method to set a property with an XMPDateTime-object, which is serialized to an ISO8601 date.
The namespace URI for the property. Has the same usage as in.
The name of the property. Has the same usage as in .
the property value as XMPDateTime.
options of the property to set (optional).
Wraps all exceptions that may occur.
The namespace URI for the property
The name of the property
the property value as XMPDateTime
Wraps all exceptions
Convenience method to set a property with a Calendar-object, which is serialized to an ISO8601 date.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
the property value as Calendar.
options of the property to set (optional).
Wraps all exceptions that may occur.
The namespace URI for the property
The name of the property
the property value as Calendar
Wraps all exceptions
Convenience method to set a property from a binary byte[]-array, which is serialized as base64-string.
The namespace URI for the property. Has the same usage as in .
The name of the property. Has the same usage as in .
the literal property value as byte array.
options of the property to set (optional).
Wraps all exceptions that may occur.
The namespace URI for the property
The name of the property
the literal property value as byte array
Wraps all exceptions
Constructs an enumerable for the properties within this XMP object.
Wraps all errors and exceptions that may occur.
This correlates to the about-attribute, returns the empty String if no name is set.
Returns the name of the XMP object.
Sets the name of the XMP object.
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.
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.
Perform the normalization as a separate parsing step.
Normally it is done during parsing, unless is set to true.
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 unnormalized XMPMeta object.
optional parsing options.
Wraps all errors and exceptions that may occur.
Renders this node and the tree under this node in a human readable form.
Returns a multiline string containing the dump.
Models a a text property together with its language and options.
Stefan Makswit
23.01.2006
Returns the value of the property.
Returns the options of the property.
Only set by .
Returns the language of the alt-text item.
Models a property together with its path and namespace.
Instances of this type are are iterated via .
Stefan Makswit
06.07.2006
Returns the namespace of the property
Returns the path of the property, but only if returned by the iterator.
The schema registry keeps track of all namespaces and aliases used in the XMP
metadata.
At initialisation time, the default namespaces and default aliases
are automatically registered. Namespaces must be registered before
used in namespace URI parameters or path expressions. Within the XMP Toolkit
the registered namespace URIs and prefixes must be unique. Additional
namespaces encountered when parsing RDF are automatically registered. The
namespace URI should always end in an XML name separator such as '/' or '#'.
This is because some forms of RDF shorthand catenate a namespace URI with an
element name to form a new URI.
Aliases in XMP serve the same purpose as Windows file shortcuts,
Macintosh file aliases, or UNIX file symbolic links. The aliases are simply
multiple names for the same property. One distinction of XMP aliases is that
they are ordered, there is an alias name pointing to an actual name. The
primary significance of the actual name is that it is the preferred name for
output, generally the most widely recognized name.
The names that can be aliased in XMP are restricted. The alias must be a top
level property name, not a field within a structure or an element within an
array. The actual may be a top level property name, the first element within
a top level array, or the default element in an alt-text array. This does not
mean the alias can only be a simple property. It is OK to alias a top level
structure or array to an identical top level structure or array, or to the
first item of an array of structures.
Stefan Makswit
27.01.2006
Register a namespace URI with a suggested prefix.
It is not an error if the URI is already registered, no matter what the prefix is.
If the URI is not registered but the suggested prefix is in use, a unique prefix is
created from the suggested one. The actual registered prefix is always
returned. The function result tells if the registered prefix is the
suggested one.
Note: No checking is presently done on either the URI or the prefix.
The URI for the namespace. Must be a valid XML URI.
The suggested prefix to be used if the URI is not yet
registered. Must be a valid XML name.
Returns the registered prefix for this URI, is equal to the
suggestedPrefix if the namespace hasn't been registered before,
otherwise the existing prefix.
If the parameters are not accordingly set
Obtain the prefix for a registered namespace URI.
It is not an error if the namespace URI is not registered.
The URI for the namespace. Must not be null or the empty
string.
Returns the prefix registered for this namespace URI or null.
Obtain the URI for a registered namespace prefix.
It is not an error if the namespace prefix is not registered.
The prefix for the namespace. Must not be null or the empty
string.
Returns the URI registered for this prefix or null.
Returns the registered prefix/namespace-pairs as map, where the keys are the
namespaces and the values are the prefixes.
Returns the registered namespace/prefix-pairs as map, where the keys are the
prefixes and the values are the namespaces.
Deletes a namespace from the registry.
Does nothing if the URI is not registered, or if the namespaceURI
parameter is null or the empty string.
Note: Not yet implemented.
The URI for the namespace.
Determines if a name is an alias, and what it is aliased to.
The namespace URI of the alias. Must not be null or the empty string.
The name of the alias. May be an arbitrary path expression
path, must not be null or the empty string.
Returns the XMPAliasInfo for the given alias namespace and property or
null if there is no such alias.
Collects all aliases that are contained in the provided namespace.
Collects all aliases that are contained in the provided namespace.
If nothing is found, an empty array is returned.
a schema namespace URI
Returns all alias infos from aliases that are contained in the provided namespace.
Searches for registered aliases.
an XML conform qname
Returns if an alias definition for the given qname to another
schema and property is registered.
Returns the registered aliases as map, where the key is the "qname" (prefix and name)
and the value an XMPAliasInfo-object.
XMP Toolkit Version Information.
Version information for the XMP toolkit is available at runtime via .
Stefan Makswit
23.01.2006
Returns the primary release number, the "1" in version "1.2.3".
Returns the secondary release number, the "2" in version "1.2.3".
Returns the tertiary release number, the "3" in version "1.2.3".
Returns a rolling build number, monotonically increasing in a release.
Returns true if this is a debug build.
Returns a comprehensive version information string.
Options for XMPSchemaRegistryImpl#registerAlias.
Stefan Makswit
20.02.2006
This is a direct mapping.
This is a direct mapping. The actual data type does not matter.
The actual is an unordered array, the alias is to the first element of the array.
The actual is an ordered array, the alias is to the first element of the array.
The actual is an alternate array, the alias is to the first element of the array.
The actual is an alternate text array, the alias is to the 'x-default' element of the array.
the options to init with
If options are not consistant
Returns if the alias is of the simple form.
Returns a object
If the options are not consistant.
Options for XMPIterator construction.
Stefan Makswit
24.01.2006
Just do the immediate children of the root, default is subtree.
Just do the leaf nodes, default is all nodes in the subtree.
Just do the leaf nodes, default is all nodes in the subtree.
Bugfix #2658965: If this option is set the Iterator returns the namespace
of the leaf instead of the namespace of the base property.
Return just the leaf part of the path, default is the full path.
Omit all qualifiers.
The base class for a collection of 32 flag bits.
The base class for a collection of 32 flag bits. Individual flags are defined as enum value bit
masks. Inheriting classes add convenience accessor methods.
Stefan Makswit
24.01.2006
the internal int containing all options
a map containing the bit names
The default constructor.
Constructor with the options bit mask.
the options bit mask
If the options are not correct
Resets the options.
an option bitmask
Returns true, if this object is equal to the given options.
an option bitmask
Returns true, if this object contains all given options.
an option bitmask
Returns true, if this object contain at least one of the given options.
the binary bit or bits that are requested
Returns if all of the requested bits are set or not.
the binary bit or bits that shall be set to the given value
the boolean value to set
Is friendly to access it during the tests.
Returns the options.
The options to set.
If the options are not correct
Creates a human readable string from the set options.
Note: This method is quite expensive and should only be used within tests or as
Returns a string listing all options that are set to true by their name,
like "option1 | option4".
Returns the options as hex bitmask.
To be implemented by inheritants.
Returns a bit mask where all valid option bits are set.
To be implemented by inheritants.
a single, valid option bit.
Returns a human readable name for an option bit.
The inheriting option class can do additional checks on the options.
The inheriting option class can do additional checks on the options.
Note: For performance reasons this method is only called
when setting bitmasks directly.
When get- and set-methods are used, this method must be called manually,
normally only when the Options-object has been created from a client
(it has to be made public therefore).
the bitmask to check.
Thrown if the options are not consistent.
Checks options before they are set.
First it is checked if only defined options are used, second the additional
-method is called.
the options to check
Thrown if the options are invalid.
Looks up or asks the inherited class for the name of an option bit.
Looks up or asks the inherited class for the name of an option bit.
Its save that there is only one valid option handed into the method.
a single option bit
Returns the option name or undefined.
Returns the optionNames map and creates it if required.
Options for .
Stefan Makswit
24.01.2006
Require a surrounding "x:xmpmeta" element in the xml-document.
Do not reconcile alias differences, throw an exception instead.
Convert ASCII control characters 0x01 - 0x1F (except tab, cr, and lf) to spaces.
If the input is not unicode, try to parse it as ISO-8859-1.
Do not carry run the XMPNormalizer on a packet, leave it as it is.
Disallow DOCTYPE declarations to prevent entity expansion attacks.
Map of nodes whose children are to be limited.
Sets the options to the default values.
Returns true if some XMP nodes have been limited.
the Map with name of nodes and number-of-items to limit them to
Returns the instance to call more set-methods.
Returns map containing names oF XMP nodes to limit and number-of-items limit corresponding to the XMP nodes.
The property flags are used when properties are fetched from the XMPMeta-object
and provide more detailed information about the property.
Stefan Makswit
03.07.2006
may be used in the future
Default constructor
Initialization constructor
the initialization options
If the options are not valid
Get and set whether the property value is a URI. It is serialized to RDF using the
rdf:resource attribute. Not mandatory for URIs, but considered RDF-savvy.
Return whether the property has qualifiers. These could be an xml:lang
attribute, an rdf:type property, or a general qualifier. See the
introductory discussion of qualified properties for more information.
Return whether this property is a qualifier for some other property. Note that if the
qualifier itself has a structured value, this flag is only set for the top node of
the qualifier's subtree. Qualifiers may have arbitrary structure, and may even have
qualifiers.
Return whether this property has an xml:lang qualifier.
Return whether this property has an rdf:type qualifier.
Return whether this property contains nested fields.
Return whether this property is an array. By itself this indicates a general
unordered array. It is serialized using an rdf:Bag container.
Return whether this property is an ordered array. Appears in conjunction with
getPropValueIsArray(). It is serialized using an rdf:Seq container.
Return whether this property is an alternative array. Appears in conjunction with
getPropValueIsArray(). It is serialized using an rdf:Alt container.
Return whether this property is an alt-text array. Appears in conjunction with
getPropArrayIsAlternate(). It is serialized using an rdf:Alt container.
Each array element is a simple property with an xml:lang attribute.
Return whether this property is an array with a limit on number-of-elements.
the limit to set on number-of-elements
Returns this to enable cascaded options.
Returns the current limit on number-of-elements
Returns whether the SCHEMA_NODE option is set.
Returns whether the property is of composite type - an array or a struct.
Returns whether the property is of composite type - an array or a struct.
Compares two options set for array compatibility.
other options
Returns true if the array options of the sets are equal.
Merges the set options of a another options object with this.
Merges the set options of a another options object with this.
If the other options set is null, this objects stays the same.
other options
If illegal options are provided
Returns true if only array options are set.
Checks that a node not a struct and array at the same time;
and URI cannot be a struct.
the bitmask to check.
Thrown if the options are not consistent.
Options for .
/// Stefan Makswit
24.01.2006
Bit indicating little endian encoding, unset is big endian
Bit indication UTF16 encoding.
UTF8 encoding; this is the default
Default constructor.
Constructor using initial options
the initial options
Thrown if options are not consistent.
Omit the XML packet wrapper.
Omit the <x:xmpmeta> tag.
Mark packet as read-only.
Default is a writeable packet.
Use a compact form of RDF.
Use a compact form of RDF.
The compact form is the default serialization format (this flag is technically ignored).
To serialize to the canonical form, set the flag USE_CANONICAL_FORMAT.
If both flags "compact" and "canonical" are set, canonical is used.
Use the canonical form of RDF if set.
By default the compact form is used.
Serialize as "Plain XMP", not RDF.
Include a padding allowance for a thumbnail image.
Include a padding allowance for a thumbnail image. If no xmp:Thumbnails property
is present, the typical space for a JPEG thumbnail is used.
The padding parameter provides the overall packet length.
The padding parameter provides the overall packet length. The actual amount of padding is
computed. An exception is thrown if the packet exceeds this length with no padding.
Sort the struct properties and qualifier before serializing
UTF16BE encoding
UTF16LE encoding
The number of levels of indentation to be used for the outermost XML element in the
serialized RDF.
The number of levels of indentation to be used for the outermost XML element in the
serialized RDF. This is convenient when embedding the RDF in other text, defaults to 0.
The string to be used for each level of indentation in the serialized
RDF.
The string to be used for each level of indentation in the serialized
RDF. If empty it defaults to two ASCII spaces, U+0020.
The string to be used as a line terminator.
The string to be used as a line terminator. If empty it defaults to; linefeed, U+000A, the
standard XML newline.
The amount of padding to be added if a writeable XML packet is created.
The amount of padding to be added if a writeable XML packet is created. If zero is passed
(the default) an appropriate amount of padding is computed.
Returns the text encoding to use.
Returns clone of this SerializeOptions-object with the same options set.
Options for .
Stefan Makswit
24.01.2006
Default constructor.
Constructor using initial options
the initial options
Thrown if options are not consistent.
Returns clone of this TemplateOptions-object with the same options set.
Stefan Makswit
The XML namespace for XML.
The XML namespace for RDF.
The XML namespace for the Dublin Core schema.
The XML namespace for the IPTC Core schema.
The XML namespace for the IPTC Extension schema.
The XML namespace for the DICOM medical schema.
The XML namespace for the PLUS (Picture Licensing Universal System, http://www.useplus.org)
The XML namespace Adobe XMP Metadata.
The XML namespace for the XMP "basic" schema.
The XML namespace for the XMP copyright schema.
The XML namespace for the XMP digital asset management schema.
The XML namespace for the job management schema.
The XML namespace for the job management schema.
The XML namespace for the PDF schema.
The XML namespace for the PDF schema.
The XML namespace for the Photoshop custom schema.
The XML namespace for the Photoshop Album schema.
The XML namespace for Adobe's EXIF schema.
NS for the CIPA XMP for Exif document v1.1
The XML namespace for Adobe's TIFF schema.
BExt Schema
RIFF Info Schema
Transform XMP
Adobe Flash SWF
Adobe Creative Cloud Video
legacy Dublin Core NS, will be converted to NS_DC
The XML namespace for qualifiers of the xmp:Identifier property.
The XML namespace for fields of the Dimensions type.
The XML namespace for fields of a graphical image.
The XML namespace for fields of a graphical image. Used for the Thumbnail type.
The XML namespace for fields of the ResourceEvent type.
The XML namespace for fields of the ResourceRef type.
The XML namespace for fields of the Version type.
The XML namespace for fields of the JobRef type.
The canonical true string value for Booleans in serialized XMP.
The canonical true string value for Booleans in serialized XMP. Code that converts from the
string to a bool should be case insensitive, and even allow "1".
The canonical false string value for Booleans in serialized XMP.
The canonical false string value for Booleans in serialized XMP. Code that converts from the
string to a bool should be case insensitive, and even allow "0".
Index that has the meaning to be always the last item in an array.
Node name of an array item.
The x-default string for localized properties
xml:lang qualifier
rdf:li syntaxTerm
Does not appear in the original Java version. Added because of its usage in
ParseRdf.cs and XmpNode.cs when string-comparing for array items.
rdf:type qualifier
Processing Instruction (PI) for xmp packet
XMP meta tag version new
XMP meta tag version old
A factory to create instances from a or an
ISO 8601 string or for the current time.
Stefan Makswit
16.02.2006
Creates an from a -object.
a -object.
An -object.
Creates an empty -object.
Returns an -object.
Creates an -object from initial values.
years
months from 1 to 12 (Remember that the month in is defined from 0 to 11)
days
Returns an -object.
Creates an -object from initial values.
years
months from 1 to 12 (Remember that the month in is defined from 0 to 11)
days
hours
minutes
seconds
nanoseconds
Returns an -object.
Creates an from an ISO 8601 string.
The ISO 8601 string representation of the date/time.
An -object.
When the ISO 8601 string is non-conform
Obtain the current date and time.
Returns The returned time is UTC, properly adjusted for the local time zone. The
resolution of the time is not guaranteed to be finer than seconds.
Sets the local time zone without touching any other Any existing time zone value is replaced,
the other date/time fields are not adjusted in any way.
the variable containing the value to be modified.
Returns an updated -object.
Make sure a time is UTC.
Make sure a time is UTC. If the time zone is not UTC, the time is
adjusted and the time zone set to be UTC.
the variable containing the time to
be modified.
Returns an updated -object.
Make sure a time is local.
Make sure a time is local. If the time zone is not the local zone, the time is adjusted and
the time zone set to be local.
the variable containing the time to be modified.
Returns an updated -object.
Stefan Makswit
This code is introduced by Java.
This exception wraps all errors that occur in the XMP Toolkit.
Stefan Makswit
16.02.2006
Gets the error code of the XMP toolkit.
Constructs an exception with a message and an error code.
the message
the error code
Constructs an exception with a message, an error code and an inner exception.
the error message.
the error code
the exception source
Parses and serialises instances.
Stefan Makswit
30.01.2006
Returns the singleton instance of the .
Returns an empty instance.
These functions support parsing serialized RDF into an XMP object, and serializing an XMP
object into RDF.
These functions support parsing serialized RDF into an XMP object, and serializing an XMP
object into RDF. The input for parsing may be any valid Unicode
encoding. ISO Latin-1 is also recognized, but its use is strongly discouraged. Serialization
is always as UTF-8.
parseFromBuffer() parses RDF from an Stream. The encoding
is recognized automatically.
an Stream
Options controlling the parsing.
The available options are:
- XMP_REQUIRE_XMPMETA - The <x:xmpmeta> XML element is required around <rdf:RDF>.
- XMP_STRICT_ALIASING - Do not reconcile alias differences, throw an exception.
Note: The XMP_STRICT_ALIASING option is not yet implemented.
Returns the XMPMeta-object created from the input.
If the file is not well-formed XML or if the parsing fails.
Creates an XMPMeta-object from a string.
a String contain an XMP-file.
Options controlling the parsing.
Returns the XMPMeta-object created from the input.
If the file is not well-formed XML or if the parsing fails.
Creates an XMPMeta-object from a byte-buffer.
a String contain an XMP-file.
Options controlling the parsing.
Returns the XMPMeta-object created from the input.
If the file is not well-formed XML or if the parsing fails.
Serializes an XMPMeta-object as RDF into an OutputStream.
a metadata object
Options to control the serialization (see ).
an OutputStream to write the serialized RDF to.
on serialization errors.
Serializes an XMPMeta-object as RDF into a byte buffer.
a metadata object
Options to control the serialization (see ).
Returns a byte buffer containing the serialized RDF.
on serialization errors.
Serializes an XMPMeta-object as RDF into a string.
Serializes an XMPMeta-object as RDF into a string. Note: Encoding
is ignored when serializing to a string.
a metadata object
Options to control the serialization (see ).
Returns a string containing the serialized RDF.
on serialization errors.
Asserts that xmp is compatible to XMPMetaImpl.s
Resets the schema registry to its original state (creates a new one).
Resets the schema registry to its original state (creates a new one).
Be careful this might break all existing XMPMeta-objects and should be used
only for testing purposes.
Obtain version information.
Utility services for the metadata object.
It has only public static functions, you cannot create
an object. These are all functions that layer cleanly on top of the core XMP toolkit.
These functions provide support for composing path expressions to deeply nested properties. The
functions XMPMeta such as GetProperty(),
getArrayItem() and getStructField() provide easy access to top
level simple properties, items in top level arrays, and fields of top level structs. They do not
provide convenient access to more complex things like fields several levels deep in a complex
struct, or fields within an array of structs, or items of an array that is a field of a struct.
These functions can also be used to compose paths to top level array items or struct fields so
that you can use the binary accessors like getPropertyAsInteger().
You can use these functions is to compose a complete path expression, or all but the last
component. Suppose you have a property that is an array of integers within a struct. You can
access one of the array items like this:
string path = XmpPathFactory.ComposeStructFieldPath(schemaNS, "Struct", fieldNS, "Array");
string path += XmpPathFactory.ComposeArrayItemPath(schemaNS, "Array", index);
PropertyInteger result = xmpObj.GetPropertyAsInteger(schemaNS, path);
You could also use this code if you want the string form of the integer:
String path = XmpPathFactory.ComposeStructFieldPath (schemaNS, "Struct", fieldNS,
"Array");
PropertyText xmpObj.GetArrayItem (schemaNS, path, index);
Note: It might look confusing that the schemaNS is passed in all of the calls above.
This is because the XMP toolkit keeps the top level "schema" namespace separate from
the rest of the path expression.
Note: These methods are much simpler than in the C++-API, they don't check the given
path or array indices.
Stefan Makswit
25.01.2006
Compose the path expression for an item in an array.
The name of the array. May be a general path expression, must not be
null or the empty string.
The index of the desired item. Arrays in XMP are indexed from 1.
0 and below means last array item and renders as [last()].
Returns the composed path basing on fullPath. This will be of the form
ns:arrayName[i], where "ns" is the prefix for schemaNS and
"i" is the decimal representation of itemIndex.
Throws exception if index zero is used.
Compose the path expression for a field in a struct.
The namespace URI for the field. Must not be null or the empty string.
The name of the field. Must be a simple XML name, must not be null or the empty string.
Returns the composed path. This will be of the form
ns:structName/fNS:fieldName, where "ns" is the prefix for
schemaNS and "fNS" is the prefix for fieldNS.
Thrown if the path to create is not valid.
Compose the path expression for a qualifier.
The namespace URI for the qualifier. May be null or the empty
string if the qualifier is in the XML empty namespace.
The name of the qualifier. Must be a simple XML name, must not be
null or the empty string.
Returns the composed path. This will be of the form
ns:propName/?qNS:qualName, where "ns" is the prefix for
schemaNS and "qNS" is the prefix for qualNS.
Thrown if the path to create is not valid.
Compose the path expression to select an alternate item by language.
The path syntax allows two forms of "content addressing" that may
be used to select an item in an array of alternatives. The form used in
ComposeLangSelector lets you select an item in an alt-text array based on
the value of its xml:lang qualifier. The other form of content
addressing is shown in ComposeFieldSelector. \note ComposeLangSelector
does not supplant SetLocalizedText or GetLocalizedText. They should
generally be used, as they provide extra logic to choose the appropriate
language and maintain consistency with the 'x-default' value.
ComposeLangSelector gives you an path expression that is explicitly and
only for the language given in the langName parameter.
The name of the array. May be a general path expression, must
not be null or the empty string.
The RFC 3066 code for the desired language.
Returns the composed path. This will be of the form
ns:arrayName[@xml:lang='langName'], where
"ns" is the prefix for schemaNS.
Compose the path expression to select an alternate item by a field's value.
The path syntax allows two forms of "content addressing" that may be used to select an item in an
array of alternatives. The form used in ComposeFieldSelector lets you select an item in an
array of structs based on the value of one of the fields in the structs. The other form of
content addressing is shown in ComposeLangSelector. For example, consider a simple struct
that has two fields, the name of a city and the URI of an FTP site in that city. Use this to
create an array of download alternatives. You can show the user a popup built from the values
of the city fields. You can then get the corresponding URI as follows:
String path = composeFieldSelector ( schemaNS, "Downloads", fieldNS, "City", chosenCity );
XMPProperty prop = xmpObj.getStructField ( schemaNS, path, fieldNS, "URI" );
The name of the array. May be a general path expression, must not be
null or the empty string.
The namespace URI for the field used as the selector. Must not be
null or the empty string.
The name of the field used as the selector. Must be a simple XML name, must
not be null or the empty string. It must be the name of a field that is
itself simple.
The desired value of the field.
Returns the composed path. This will be of the form
ns:arrayName[fNS:fieldName='fieldValue'], where "ns" is the
prefix for schemaNS and "fNS" is the prefix for fieldNS.
Thrown if the path to create is not valid.
ParameterAsserts that a qualifier namespace is set.
a qualifier namespace
Qualifier schema is null or empty
ParameterAsserts that a qualifier name is set.
a qualifier name or path
Qualifier name is null or empty
ParameterAsserts that a struct field namespace is set.
a struct field namespace
Struct field schema is null or empty
ParameterAsserts that a struct field name is set.
a struct field name or path
Struct field name is null or empty
Utility methods for XMP.
Stefan Makswit
21.02.2006
Create a single edit string from an array of strings.
The XMP object containing the array to be catenated.
The schema namespace URI for the array. Must not be null or
the empty string.
The name of the array. May be a general path expression, must
not be null or the empty string. Each item in the array must
be a simple string value.
The string to be used to separate the items in the catenated
string. Defaults to "; ", ASCII semicolon and space
(U+003B, U+0020).
The characters to be used as quotes around array items that
contain a separator. Defaults to '"'
Option flag to control the catenation.
Returns the string containing the catenated array items.
Forwards the Exceptions from the metadata processing
Separate a single edit string into an array of strings.
The XMP object containing the array to be updated.
The schema namespace URI for the array. Must not be null or
the empty string.
The name of the array. May be a general path expression, must
not be null or the empty string. Each item in the array must
be a simple string value.
The string to be separated into the array items.
Option flags to control the separation.
Flag if commas shall be preserved
Forwards the Exceptions from the metadata processing
Remove multiple properties from an XMP object.
Remove multiple properties from an XMP object.
RemoveProperties was created to support the File Info dialog's Delete
button, and has been been generalized somewhat from those specific needs.
It operates in one of three main modes depending on the schemaNS and
propName parameters:
- Non-empty schemaNS and propName - The named property is
removed if it is an external property, or if the
flag doAllProperties option is true. It does not matter whether the
named property is an actual property or an alias.
- Non-empty schemaNS and empty propName - The all external
properties in the named schema are removed. Internal properties are also
removed if the flag doAllProperties option is set. In addition,
aliases from the named schema will be removed if the flag includeAliases
option is set.
- Empty schemaNS and empty propName - All external properties in
all schema are removed. Internal properties are also removed if the
flag doAllProperties option is passed. Aliases are implicitly handled
because the associated actuals are internal if the alias is.
It is an error to pass an empty schemaNS and non-empty propName.
The XMP object containing the properties to be removed.
Optional schema namespace URI for the properties to be
removed.
Optional path expression for the property to be removed.
Option flag to control the deletion: do internal properties in
addition to external properties.
Option flag to control the deletion:
Include aliases in the "named schema" case above.
Note: Currently not supported.
Forwards the Exceptions from the metadata processing
Append properties from one XMP object to another.
Append properties from one XMP object to another.
XMPUtils#appendProperties was created to support the File Info dialog's Append button, and
has been been generalized somewhat from those specific needs. It appends information from one
XMP object (source) to another (dest). The default operation is to append only external
properties that do not already exist in the destination. The flag
doAllProperties can be used to operate on all properties, external and internal.
The flag replaceOldValues option can be used to replace the values
of existing properties. The notion of external
versus internal applies only to top level properties. The keep-or-replace-old notion applies
within structs and arrays as described below.
- If replaceOldValues is true then the processing is restricted to the top
level properties. The processed properties from the source (according to
doAllProperties) are propagated to the destination,
replacing any existing values.Properties in the destination that are not in the source
are left alone.
- If replaceOldValues is not passed then the processing is more complicated.
Top level properties are added to the destination if they do not already exist.
If they do exist but differ in form (simple/struct/array) then the destination is left alone.
If the forms match, simple properties are left unchanged while structs and arrays are merged.
- If deleteEmptyValues is passed then an empty value in the source XMP causes
the corresponding destination XMP property to be deleted. The default is to treat empty
values the same as non-empty values. An empty value is any of a simple empty string, an array
with no items, or a struct with no fields. Qualifiers are ignored.
The detailed behavior is defined by the following pseudo-code:
appendProperties ( sourceXMP, destXMP, doAllProperties,
replaceOldValues, deleteEmptyValues ):
for all source schema (top level namespaces):
for all top level properties in sourceSchema:
if doAllProperties or prop is external:
appendSubtree ( sourceNode, destSchema, replaceOldValues, deleteEmptyValues )
appendSubtree ( sourceNode, destParent, replaceOldValues, deleteEmptyValues ):
if deleteEmptyValues and source value is empty:
delete the corresponding child from destParent
else if sourceNode not in destParent (by name):
copy sourceNode's subtree to destParent
else if replaceOld:
delete subtree from destParent
copy sourceNode's subtree to destParent
else:
// Already exists in dest and not replacing, merge structs and arrays
if sourceNode and destNode forms differ:
return, leave the destNode alone
else if form is a struct:
for each field in sourceNode:
AppendSubtree ( sourceNode.field, destNode, replaceOldValues )
else if form is an alt-text array:
copy new items by "xml:lang" value into the destination
else if form is an array:
copy new items by value into the destination, ignoring order and duplicates
Note: appendProperties can be expensive if replaceOldValues is not passed and
the XMP contains large arrays. The array item checking described above is n-squared.
Each source item is checked to see if it already exists in the destination,
without regard to order or duplicates.
Simple items are compared by value and "xml:lang" qualifier, other qualifiers are ignored.
Structs are recursively compared by field names, without regard to field order. Arrays are
compared by recursively comparing all items.
The source XMP object.
The destination XMP object.
Do internal properties in addition to external properties.
Replace the values of existing properties.
Delete destination values if source property is empty.
Forwards the Exceptions from the metadata processing
Convert from string to Boolean.
The string representation of the Boolean.
The appropriate boolean value for the string. The checked values
for true and false are:
- and
- "t" and "f"
- "on" and "off"
- "yes" and "no"
- "value <> 0" and "value == 0"
If an empty string is passed.
Convert from boolean to string.
a boolean value
The XMP string representation of the boolean. The values used are
given by the constants and
.
Converts a string value to an int.
the string value
Returns an int.
If the rawValue is null or empty or the
conversion fails.
Convert from int to string.
an int value
The string representation of the int.
Converts a string value to a long.
the string value
Returns a long.
If the rawValue is null or empty or the
conversion fails.
Convert from long to string.
a long value
The string representation of the long.
Converts a string value to a double.
the string value
Returns a double.
If the rawValue is null or empty or the
conversion fails.
Convert from long to string.
a long value
The string representation of the long.
Converts a string value to an XMPDateTime.
the string value
Returns an XMPDateTime-object.
If the rawValue is null or empty or the
conversion fails.
Convert from XMPDateTime to string.
an XMPDateTime
The string representation of the long.
Convert from a byte array to a base64 encoded string.
the byte array to be converted
Returns the base64 string.
Decode from Base64 encoded string to raw data.
a base64 encoded string
Returns a byte array containing the decoded string.
Thrown if the given string is not property base64 encoded
Creates XMP serializations appropriate for a JPEG file.
The standard XMP in a JPEG file is limited to 64K bytes. This function
serializes the XMP metadata in an XMP object into a string of RDF . If
the data does not fit into the 64K byte limit, it creates a second packet
string with the extended data.
The XMP object containing the metadata.
A string builder object in which to return the full standard XMP packet.
A string builder object in which to return the serialized extended XMP, empty if not needed.
A string builder object in which to return an MD5 digest of the serialized extended XMP, empty if not needed.
@throws NoSuchAlgorithmException if fail to find algorithm for MD5
Forwards the Exceptions from the metadata processing
Merges standard and extended XMP retrieved from a JPEG file.
When an extended partition stores properties that do not fit into the
JPEG file limitation of 64K bytes, this function integrates those
properties back into the same XMP object with those from the standard XMP
packet.
An XMP object which the caller has initialized from the standard XMP packet in a JPEG file. The extended XMP is added to this object.
An XMP object which the caller has initialized from the extended XMP packet in a JPEG file.
Forwards the Exceptions from the metadata processing
Modifies a working XMP object according to a template object.
The XMP template can be used to add, replace or delete properties from
the working XMP object. The actions that you specify determine how the
template is applied.Each action can be applied individually or combined;
if you do not specify any actions, the properties and values in the
working XMP object do not change.
These actions are available:
- Clear CLEAR_UNNAMED_PROPERTIES : Deletes top-level
properties.Any top-level property that is present in the template(even
with empty value) is retained.All other top-level properties in the
working object are deleted
- Add ADD_NEW_PROPERTIES: Adds new properties to the
working object if the template properties have values.See additional
detail below.
- Replace REPLACE_EXISTING_PROPERTIES: Replaces the
values of existing top-level properties in the working XMP if the value
forms match those in the template. Properties with empty values in the
template are ignored. If combined with Clear or Add actions, those take
precedence; values are cleared or added, rather than replaced.
- Replace/Delete empty REPLACE_WITH_DELETE_EMPTY:
Replaces values in the same way as the simple Replace action, and also
deletes properties if the value in the template is empty.If combined
with Clear or Add actions, those take precedence; values are cleared or
added, rather than replaced.
- Include internal INCLUDE_INTERNAL_PROPERTIES: Performs
specified action on internal properties as well as external properties.
By default, internal properties are ignored for all actions.
The Add behavior depends on the type of property:
- If a top-level property is not in the working XMP, and has a value in
the template, the property and value are added.Empty properties are not
added.
- If a property is in both the working XMP and template, the value
forms must match, otherwise the template is ignored for that property.
- If a struct is present in both the working XMP and template, the
individual fields of the template struct are added as appropriate; that
is, the logic is recursively applied to the fields.Struct values are
equivalent if they have the same fields with equivalent values.
- If an array is present in both the working XMP and template, items
from the template are added if the value forms match. Array values match
if they have sets of equivalent items, regardless of order.
- Alt-text arrays use the \c xml:lang qualifier as a key, adding languages that are missing.
Array item checking is n-squared; this can be time-intensive if the
Replace option is not specified.Each source item is checked to see if it
already exists in the destination, without regard to order or duplicates.
Simple items are compared by value and xml:lang qualifier;
other qualifiers are ignored.Structs are recursively compared by field
names, without regard to field order.Arrays are compared by recursively
comparing all items.
The destination XMP object.
The template to apply to the destination XMP object.
Option flags to control the copying. If none are specified,
the properties and values in the working XMP do not change. A logical OR of these bit-flag constants:
- CLEAR_UNNAMED_PROPERTIES Delete anything that is not in the template
- ADD_NEW_PROPERTIES Add properties; see detailed description.
- REPLACE_EXISTING_PROPERTIES Replace the values of existing properties.
- REPLACE_WITH_DELETE_EMPTY Replace the values of existing properties and delete properties if the new value is empty.
- INCLUDE_INTERNAL_PROPERTIES Operate on internal properties as well as external properties.
Forwards the Exceptions from the metadata processing
Replicate a subtree from one XMP object into another, possibly at a
different location.
The source XMP object.
The destination XMP object.
The schema namespace URI for the source subtree.
The root location for the source subtree. May be a general path expression, must not be null or the empty string.
The schema namespace URI for the destination. Defaults to the source namespace.
The root location for the destination. May be a general path expression. Defaults to the source location.
Option flags to control the separation. (For now, this argument is ignored. 0 should be passed.
Forwards the Exceptions from the metadata processing
http://grepcode.com/file_/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/PushbackReader.java/?v=source