std::string pathSoftSensors;
std::string pathDescription;
- xmlDoc.parse<0>((char *)xmlDescription.c_str());
+ try
+ {
+ xmlDoc.parse<0>((char *)xmlDescription.c_str());
- root = xmlDoc.first_node();
+ root = xmlDoc.first_node();
- strKey = root->name();
+ if (!root)
+ {
+ throw rapidxml::parse_error("No Root Element", 0);
+ }
- if (strKey != "SSMCore")
- {
- return SSM_E_FAIL;
- }
+ strKey = root->name();
- for (itemSSMCore = root->first_node(); itemSSMCore; itemSSMCore = itemSSMCore->next_sibling())
- {
- strKey = itemSSMCore->name();
+ if (strKey != "SSMCore")
+ {
+ throw rapidxml::parse_error("Invalid root tag name", 0);
+ }
- if (strKey == "Device")
+ for (itemSSMCore = root->first_node(); itemSSMCore; itemSSMCore = itemSSMCore->next_sibling())
{
- for (itemDevice = itemSSMCore->first_node(); itemDevice; itemDevice = itemDevice->next_sibling())
- {
- strKey = itemDevice->name();
+ strKey = itemSSMCore->name();
- if (strKey == "Name")
- {
- name = itemDevice->value();
- }
- else if (strKey == "Type")
- {
- type = itemDevice->value();
- }
- else
+ if (strKey == "Device")
+ {
+ for (itemDevice = itemSSMCore->first_node(); itemDevice; itemDevice = itemDevice->next_sibling())
{
- ;/*NULL*/
+ strKey = itemDevice->name();
+
+ if (strKey == "Name")
+ {
+ name = itemDevice->value();
+ }
+ else if (strKey == "Type")
+ {
+ type = itemDevice->value();
+ }
+ else
+ {
+ ;/*NULL*/
+ }
}
}
- }
- else if (strKey == "Config")
- {
- for (itemDevice = itemSSMCore->first_node(); itemDevice; itemDevice = itemDevice->next_sibling())
+ else if (strKey == "Config")
{
- strKey = itemDevice->name();
-
- if (strKey == "SoftSensorRepository")
- {
- pathSoftSensors = itemDevice->value();
- }
- else if (strKey == "SoftSensorDescription")
- {
- pathDescription = itemDevice->value();
- }
- else
+ for (itemDevice = itemSSMCore->first_node(); itemDevice; itemDevice = itemDevice->next_sibling())
{
- ;/*NULL*/
+ strKey = itemDevice->name();
+
+ if (strKey == "SoftSensorRepository")
+ {
+ pathSoftSensors = itemDevice->value();
+ }
+ else if (strKey == "SoftSensorDescription")
+ {
+ pathDescription = itemDevice->value();
+ }
+ else
+ {
+ ;/*NULL*/
+ }
}
}
+ else
+ {
+ ;/*NULL*/
+ }
}
- else
- {
- ;/*NULL*/
- }
+ }
+ catch (rapidxml::parse_error &e)
+ {
+ SSM_CLEANUP_ASSERT(SSM_E_INVALIDXML);
}
SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_ISensingEngine, (IBase **)&m_pSensingEngine));