Implementation idea

Hi all,

I have an xml which upon startup has to be loaded to a memory. Whenever required this data from that file will be accessed by two services.

Any tips/idea of how this can be done.

Regards,
balamurali

hi murali,
i didnt get it , u have a xml file and u want to load it to a file in memory ,and this file is required by two services when ever required …
what does “when ever” mean actually , i didnt get the exact scenario of ur requirement ,can u elaborate a bit ,so that it would be helpful for WM users to help ya out.

sri

Murali,

You can do this by creating a java service. In the “shared” tab of the java service create a static String variable with the statement

public static String myXML = “”;

In the java service read your XML from its source (file system or wherever) convert it to a string and store it in the static myXML variable.

Make this a startup service. You should now be able to add a java service in the same folder that references the myXML variable to do something useful.

If this XML document might be changed at runtime, you could add extra services to reload it from the file system and refresh the cached variable.

Hope this helps,

Mark

Mark,

Excellent. It got it.

Thanks,
balamurali

Balamuralli,

Quick question: are you using this XML file as a properties file? If so, then you may want to consider loading the properties from the XML into, for example, a Properties object, a hashtable, or even an IData object. This should allow for faster retrieval during run-time than having to parse the XML string each time.

  • Percio