I am not sure though I was able to achieve following
- Using Deployer Extension, I was able to read the cd_deployer_config.xml file but no other configuration file like cd_storage_config.xml I was able to read
- Using Storage Extension, I was able to read the cd_storage_config.xml file but no other file like cd_deployer_config etc. I was able to read.
In a nutshell (best of my knowledge, not sure though), directly it is not possible to interact, however you can use below generic java code to read any xml file:
/**
* Get value of a node specified by the nodeID of an XML file specified by the xmlFilePath
* @param nodeID - Node Name in the xml, value of which need to be extracted
* @param xmlFilePath - File Path
* @return Value of the XMLNode specified by the nodeID
*/
public String GetNodeValueFromXML(String nodeID, String xmlFilePath)
{
log.info("Entering GetNodeValueFromXML with XML File Path: " + xmlFilePath + " And Node ID: "+ nodeID);
String returnValue = null;
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = null;
Document doc = null;
try
{
docBuilder = docBuilderFactory.newDocumentBuilder();
doc = docBuilder.parse(new File(xmlFilePath));
NodeList nodeList = doc.getElementsByTagName(nodeID);
if(nodeList != null && nodeList.getLength() > 0)
{
returnValue = nodeList.item(0).getTextContent();
}
}
catch (<Exception Type> e)
{
//Catch Exception Here
}
finally
{
doc= null;
docBuilder = null;
docBuilderFactory = null;
}
log.info("Exiting GetNodeValueFromXML Method");
return returnValue;
}