How to set the publication conditions through API

Hi,

How can we set the conditions to the publication through API  PublicationOutput 2.5 SetMetadata. My metadata is as below to add the features for the FISHPUBCONTEXT in ishfields. Could not add the child elements under the ishfield.

var myMetadata = "<ishfields><ishfield name = 'FISHPUBCONTEXT' level='version'>" +

                     "<features>< feature name ='legacy' value='filter3' /></ features >" +

                 "</ishfield></ishfields>";

The error recieved is 

[-105002] The XML of xmlMetadata did not pass schema ISHGeneralFields validation. The element 'ishfield' cannot contain child element 'features'
because the parent element's content model is text only. [105002;SchemaValidationFailure]
Parents
  • Dear Sunil,

    You have to escape your xml which is the content of the field to be updated.

    So please try what happens if you supply the following:

    var myMetadata = "<ishfields><ishfield name='FISHPUBCONTEXT' level='version'>" +

                         "&lt;features&gt; &lt;feature name='legacy' value='filter3' /&gt; &lt;/features &gt;" +

                    "</ishfield></ishfields>";

    This should solve your issue as now the content of the ishfield tag is text.

    Kind Regards,


    Raf

Reply
  • Dear Sunil,

    You have to escape your xml which is the content of the field to be updated.

    So please try what happens if you supply the following:

    var myMetadata = "<ishfields><ishfield name='FISHPUBCONTEXT' level='version'>" +

                         "&lt;features&gt; &lt;feature name='legacy' value='filter3' /&gt; &lt;/features &gt;" +

                    "</ishfield></ishfields>";

    This should solve your issue as now the content of the ishfield tag is text.

    Kind Regards,


    Raf

Children
No Data