To import the assets through XMLPost, we need to invoke the XMLPost Utility. We will now see how to invoke XMLPost through a program:

1. To invoke the XMLPost utility programmatically, first we need to create an XMLPost object.

Example: COM.FutureTense.XML.Post.XMLPost samplePoster = new COM.FutureTense.XML.Post.XMLPost();

2. Using that object, we need to call the doIt method of the XMLPost.

Syntax: doIt(String[] args)

3. The elements of the array are the path values of source file and ini files. Here, the source parameter can point to:

            • A single file, like -s/sample/Article-add.xml

            • A directory of XML files, like -s/sample/source-xml-files/

           •  A list file, like -s/sample/xmlpostfiles.lst

The list file provides a list of all the files that you want to import. It is similar to an .ini file but with extension of .lst.

In total, we need to program as follows. Include other calls to any other elements basing on your requirement.

………… Your code here…………..

strSourceFileDir = “-s/sample/Article-add.xml”;
strConfigFile = “-c/sample/Article-add-config.ini”;

String args[]  = {strSourceFileDir,strConfigFile};

COM.FutureTense.XML.Post.XMLPost samplePoster = new COM.FutureTense.XML.Post.XMLPost();
try
{
    samplePoster.doIt(args);   // here we are supplying the xml and ini file values
}
catch (Exception e)
{
    ics.LogMsg(” —- your error message here —–“);
}
  ………… Your code here…………..

That’s it. The XMLPost will be invoked, and basing on the source files the importing of assets will be done.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s