Access XML metadata
Posted: Tue Mar 19, 2013 4:09 am
Enfocus Community -
I am writing a script to assist in sorting a PDF that has had XML metadata added via the XML pickup flow element.
In the javascript I am creating I reference the dataset as:
var xml = job.getDataset( "Xml" );
However when I try to access the dataset via:
var itemNode = xml.evalToNode(nodexpath);
I get an error message stating "TypeError. evalToNode undefined or not a function".
I can also note that autocomplete in the script editor did not seem to find evalToNode as valid either however it is an xml data structure being added as metadata.
Is there a way to work around this?
To be complete in the data I am providing, I have an XML such as:
1234.pdf
2
4321.pdf
1
And I have both PDFs (assets) and I need to be able to sort by the data relative to the filename node. This is all one "job", which I have split into separate jobs each with their own copy of the XML, then taken those seperate jobs and used "XML pickup" against them. Now, I just need to be able to get the appropriate elements (relative to the particular filename) to use to sort the asset for the now split job(s) (which can each be independent of each-other without issue).
If anyone has an idea for a better way to do this - I'm all ears.. I did try a condition, but I cannot get the XPATH filter ( the [filename=this] ) to correctly filter based upon the filename or the job name. If you know something to replace the "this" with on the XPATH filter, that can save me doing any javascript funkyness.
Thank you in advance - all ideas are appreciated!
Matt
I am writing a script to assist in sorting a PDF that has had XML metadata added via the XML pickup flow element.
In the javascript I am creating I reference the dataset as:
var xml = job.getDataset( "Xml" );
However when I try to access the dataset via:
var itemNode = xml.evalToNode(nodexpath);
I get an error message stating "TypeError. evalToNode undefined or not a function".
I can also note that autocomplete in the script editor did not seem to find evalToNode as valid either however it is an xml data structure being added as metadata.
Is there a way to work around this?
To be complete in the data I am providing, I have an XML such as:
1234.pdf
2
4321.pdf
1
And I have both PDFs (assets) and I need to be able to sort by the data relative to the filename node. This is all one "job", which I have split into separate jobs each with their own copy of the XML, then taken those seperate jobs and used "XML pickup" against them. Now, I just need to be able to get the appropriate elements (relative to the particular filename) to use to sort the asset for the now split job(s) (which can each be independent of each-other without issue).
If anyone has an idea for a better way to do this - I'm all ears.. I did try a condition, but I cannot get the XPATH filter ( the [filename=this] ) to correctly filter based upon the filename or the job name. If you know something to replace the "this" with on the XPATH filter, that can save me doing any javascript funkyness.
Thank you in advance - all ideas are appreciated!
Matt