When I create an XMPMetaObj from a layer, I can then add properties and values as metadata to the layer.
But then, after I have done that, if I try to clean the layer from all written metadata, it seems to be impossible to get rid entirely of the XMPMetaObj.
By "entirely" I mean to get a "null" value when you try to read the rawData from the layer. This statement:
var xmp = new XMPMeta(app.activeDocument.activeLayer.xmpMetadata.rawData);
If you try it in a, how can I say, "virgin" layer, a layer that has never had any metadata written to it, you will get a "null" value.
Then you write some metadata to this layer, some properties and values, using some Namespace.
Then, if you remove ALL properties and values from all Namespaces [ instruction XMPUtils.removeProperties(xmp, "", "", XMPConst.REMOVE_ALL_PROPERTIES); ], after that if you try to open the XMPMetaObj from that layer, you will not get a "null" anymore. You will get a totally empty XMPMetaObj (dumpObject() returns nothing!) but it is still not a "null" anymore.
Is there a way to remove what it is that needs to be removed from the layer so that you get a "null" again when trying to read its XMPMetaObj? In other words, is there a way to make a layer that had metadata written to it be back to its "as new" state?
Message was edited by: agardi
Is there an answer to this?
The only way I have found so far is to reset the XMP object by assigning an empty one :
var emptyXMP = new XMPMeta();
app.activeDocument.activeLayer.xmpMetadata.rawData = emptyXMP.serialize();