Hi,
I have a jdf file which I added to an asset (JDF pickup) and now I would like to access Metadata via a script expression.
I am struggling with the syntax.
Can someone send me an example about how to access the xml(jdf) data?
Thanks
Ariel
Access Metadata within script
-
- Advanced member
- Posts: 230
- Joined: Thu Aug 07, 2014 10:04 am
Access Metadata within script
The easiest method is to use job.getVariableAsString("[Metadata.Text....]");
Build the metadata query first and then copy and paste it. Beware of escaping the double quotes!
Freddy
Build the metadata query first and then copy and paste it. Beware of escaping the double quotes!
Freddy
-
- Advanced member
- Posts: 230
- Joined: Thu Aug 07, 2014 10:04 am
Access Metadata within script
Wow, thanks - did not think of that way.
What about the other (probably more complicated way) via the metadata interface (getString())? Do you have any examples for it - (I know I should stop here - but my technical inside shouts for knowing the other possibility:))
What about the other (probably more complicated way) via the metadata interface (getString())? Do you have any examples for it - (I know I should stop here - but my technical inside shouts for knowing the other possibility:))
Access Metadata within script
var dataset = job.getDataset("Name of dataset, probably Jdf");
var metadata = new Document(dataset.getPath());
var namespaceMap = metadata.createDefaultMap();
var jobID = metadata.evalToString("/jdf:JDF/@JobID",namespaceMap);
s.log(1,jobID);
Freddy
var metadata = new Document(dataset.getPath());
var namespaceMap = metadata.createDefaultMap();
var jobID = metadata.evalToString("/jdf:JDF/@JobID",namespaceMap);
s.log(1,jobID);
Freddy
-
- Advanced member
- Posts: 230
- Joined: Thu Aug 07, 2014 10:04 am
Access Metadata within script
thank you very much, Freddy.
I already implemented your first approach but I will probably change it to this solution.
Again thanks,
Ariel
I already implemented your first approach but I will probably change it to this solution.
Again thanks,
Ariel