How to read and render an XML file from TIBCO BusinessEvents Project Resource using Relative path?

book

Article ID: KB0085565

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Description:
How to read and render an XML file from TIBCO BusinessEvents Project Resource using Relative path?

Symptoms:
If we use an Absolute path instead of Relative path of the Object then there is a chance that this path will be different in different deployment environments.


Cause:
N/A

Resolution

There is an XML file inside your project and the requirement is to render this file and copy the output to a concept. Since the file is part of the project structure, you need to use the relative path.

Example:

String sTest=File.readFileAsString("Concepts/Customer.concept");
String sRenderedXML=XPath.evalAsString("xpath:...);

The working directory needs to be set to the project directory to get the sample to work in Studio. You can also start be-engine.exe in the console and change directory to the project folder first.

Example:

cd PROJECT_HOME
BE_HOME/bin/be-engine --propFile BE_HOME/bin/be-engine.tra -c Deployments/default.cdd <locationOfEar>

Issue/Introduction

How to read and render an XML file from TIBCO BusinessEvents Project Resource using Relative path?