Creating Arrays of structured fields with XMP 3.2 SDK
i'm trying adobe xmp sdk 3.2 operate in same manner the<br />imetadataaccess interface in indesign / incopy.<br /><br />1. consider following snippet of indesign sdk code.<br /><br />foo( imetadataaccess * mymeta )<br />{<br />pmstring regprefix;<br />pmstring ns( "http://my.namespace.com/test/" );<br />pmstring nspfx( "myns" );<br /><br />mymeta->registernamespace( ns, nspfx, regprefix );<br /><br />pmstring path( "testpath" );<br /><br />// create new bag array<br /><br />mymeta->appendarrayitem( ns, path, emptystr, metadata_bag, metadata:kpropvalueisstruct );<br />.....<br />}<br /><br />this generate following entry in xmp.<br /><br /><rdf:description rdf:about="" xmlns:myns="http://my.namespace.com/test/"><br /> <myns:testpath><br /> <rdf:bag><br /> <rdf:li rdf:parsetype="resource"><br /> </rdf:li><br /> </rdf:bag><br /> </myns:testpath ><br /> </rdf:description><br /><br />2. consider following using xmp sdk<br /><br />foo2( sxmpmeta * mymeta )<br />{<br />std::string registeredprefix("");<br />pmstring emptystr("");<br /><br />mymeta->registernamespace( "http://my.namespace.com/test/" , "myns", ®isteredprefix );<br /><br />try<br />{<br />mymeta->appendarrayitem( "http://my.namespace.com/test/", "testpath", kxmp_propvalueisarray, "" );<br />.....<br />}<br />catch( ... )<br />{<br /><br />}<br />}<br /><br />this generate following entry in xmp.<br /><br /><rdf:description rdf:about="" xmlns:myns="http://my.namespace.com/test/"><br /> <myns:testpath><br /> <rdf:bag><br /> <rdf:li/><br /> </rdf:bag><br /> </myns:testpath ><br /> </rdf:description><br /><br />i.e rdf:parsetype="resource" entry missing generated xmp.<br /><br />this causes problems adding items array with<br /><br />mymeta->setstructfield( "http://my.namespace.com/test/", "testpath[1]", "http://my.namespace.com/test/", "name1", "value1" );<br /><br />i exception raised. ( setstructfield works if rdf:parsetype="resource" entry in place ).<br /><br />so question how rdf:parsetype="resource" tag appear in rdf:li element using xmp 3.2 sdk??<br /><br />my aim create xmp this<br /><br /><rdf:description rdf:about="" xmlns:myns="http://my.namespace.com/test/"><br /> <myns:testpath><br /> <rdf:bag><br /> <rdf:li/><br /> <myns:id>1111</myns:id><br /> <myns:name>albert</myns:name><br /> </rdf:li><br /> <rdf:li/><br /> <myns:id>1112</myns:id><br /> <myns:name>fred</myns:name><br /> </rdf:li><br /> </rdf:bag><br /> </myns:testpath ><br /> </rdf:description><br /><br />tia.<br />mike.
solved now!
mymeta->appendarrayitem( "http://my.namespace.com/test/", "testpath", kxmp_propvalueisarray, "" );
should
mymeta->appendarrayitem( "http://my.namespace.com/test/", "testpath", kxmp_propvalueisarray, nil, kxmp_propvalueisstruct );
mymeta->appendarrayitem( "http://my.namespace.com/test/", "testpath", kxmp_propvalueisarray, "" );
should
mymeta->appendarrayitem( "http://my.namespace.com/test/", "testpath", kxmp_propvalueisarray, nil, kxmp_propvalueisstruct );
More discussions in XMP SDK
adobe
Comments
Post a Comment