2 Replies Latest reply on Dec 13, 2011 7:58 AM by Harbs.

    Adding XMP metadata into new illustrator document

    TheDollarBill Level 1

      var app:Application = Illustrator.app;

      var doc:Document = app.activeDocument;

      var xmpString:String = doc.XMPString;

      var xmpMeta : XMPMeta = new XMPMeta(xmpString);                       

      var myNamespace : Namespace = new Namespace("test", "http://test.thisiscool");

      xmpMeta.myNamespace::stringName = "supercool";

      var tmp : String = xmpMeta.serialize();

      doc.XMPString = tmp;



      If I execute the above code block I end up with the following metadata inside the document:



      <rdf:Description rdf:about=""





      Why is the prefix defaulted to ns1 when I specified that it should be "test"?

      The documentation says you can register your own custom prefixes. But it doesn't say weather it's possible to do that programatically.  Is it?  If not, how is it done?:

      Prefixes are not stored in the data model, but only in namespace URIs. The parser collects the namespace prefixes, to be used when the same XMPMeta object is serialized after modification. For the Adobe standard namespaces, defined in the XMP Specification: Part 2, Standard Schemas, the default namespaces are stored in a global namespace registry of the library. You can also register custom prefixes for your own namespaces; if the serializer does not find a registered prefix for a certain namespace, it generates prefixes of the form "ns1", "ns2" and so on.