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:
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.
Oops, I posted this in the wrong forum. I hope reposting in the Creative Suite Extension Builder forum doesn't bother anyone. Sorry.
The CS SDK forum is actually probably more correct, but this is probably an Illustrator scripting question.
You might be able to add the namespace using the XMP Namespace Designer, but I'm not sure...