Thursday, June 17, 2004

Indesign SDK - Query story metadata

How to query for story's metadata?

Simple, assuming storyRef is the UIDRef of the story:

    Utils inCopyWorkFlowUtils;

InterfacePtr model(storyRef, IID_ITEXTMODEL);
ASSERT(model);
InterfacePtr iMetaData(inCopyWorkFlowUtils->QueryTextMetaDataBoss(model, kTrue));
if (iMetaData) {
InterfacePtr mdAcc(iMetaData, UseDefaultIID());
if (mdAcc) {
InterfacePtr mdPaths(mdAcc->Enumerate(0));
if (mdPaths) {
// iterate thru all paths
while (mdPaths->HasMorePaths()) {
PMString nspace, path;
// get the next path (by namespace and path)
mdPaths->GetNextPath(nspace, path);
PMString value;
MetaDataFeatures metaDataFeatures;
// inspect the node
if (mdAcc->Get(nspace, path, value, metaDataFeatures))
{
}
}
}
}
}

 

No comments: