Skip to main content
Participant
September 13, 2022
Answered

Custom XMP schema - add programatically

  • September 13, 2022
  • 1 reply
  • 477 views

Hi,

 

I am trying to create custom XMP schema programatically and insert some properties with values there. Not completely sure if it’s possible, but this is how I try to do it:

 

 

    var namespace = "http://ns.adobe.com/MyName/1.0/";
    var prefix = "MyNameShort";
    var registered = XMPMeta.registerNamespace(namespace, prefix);

    var projectItem = app.project.rootItem.children[0];
    if (projectItem) {
        if (ExternalObject.AdobeXMPScript === undefined) {
            ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
        }
        if (ExternalObject.AdobeXMPScript !== undefined) {
            var xmpBlob = projectItem.getXMPMetadata();
            var xmp = new XMPMeta(xmpBlob);

            xmp.setProperty(namespace, "creator", "Team");
            xmp.setProperty(namespace, "fruit", "apple");

            var xmpAsString = xmp.serialize();
            projectItem.setXMPMetadata(xmpAsString);
        }
    }

 

 

This does not do anything obvious to me, doesn’t throw an error, but I don’t find a new schema with the given namespace or the new properties. What am I doing wrong?

Additionaly - if this is possible and the custom schema is created and new properties are inserted - on second attempt to use it - how will I check if the schema does already exist or should be created?

 

Thank you in advance!

This topic has been closed for replies.
Correct answer Bruce Bullis

Hi Veronika,

 

I'm not sure your namespace declaration will work, as there's nothing hanging off of the adobe.com domain, named "MyName"....

Typically, custom schemae are deployed by:

  • Create a new schema using PPro's Metadata Display view
  • Find the resultant SchemaName.xml file at:

                  Win: C:\Users\[username]\AppData\Roaming\Adobe\XMP\Custom File Info Panels\4.0\custom

                  Mac: Users/[username]/Library/Application Support/Adobe/XMP/Custom File Info Panels/4.0/custom

  • Copy the .xml file into place on the destination system
  • Manually enable [sorry!] the schema on the destination system, using PPro's Metadata Display view.


Admittedly, the above approach is not programmatic, but it does work. 🙂

1 reply

Bruce Bullis
Community Manager
Bruce BullisCommunity ManagerCorrect answer
Community Manager
September 13, 2022

Hi Veronika,

 

I'm not sure your namespace declaration will work, as there's nothing hanging off of the adobe.com domain, named "MyName"....

Typically, custom schemae are deployed by:

  • Create a new schema using PPro's Metadata Display view
  • Find the resultant SchemaName.xml file at:

                  Win: C:\Users\[username]\AppData\Roaming\Adobe\XMP\Custom File Info Panels\4.0\custom

                  Mac: Users/[username]/Library/Application Support/Adobe/XMP/Custom File Info Panels/4.0/custom

  • Copy the .xml file into place on the destination system
  • Manually enable [sorry!] the schema on the destination system, using PPro's Metadata Display view.


Admittedly, the above approach is not programmatic, but it does work. 🙂