// 修改AlarmInCode
 IVS_INT32 CXmlProcess::SetAlarmInCodeValue(const IVS_CHAR* pPath, CXml& xml)
 {
	 CHECK_POINTER(pPath, IVS_OPERATE_MEMORY_ERROR);

	 if (!xml.FindElemEx(pPath))
	 {
		 BP_RUN_LOG_ERR(IVS_XML_INVALID, "SetAlarmInCodeValue", "xml.FindElemEx(pPath)");
		 return IVS_XML_INVALID;
	 }

	 const IVS_CHAR* pElemValue = xml.GetElemValue();
	 IVS_CHAR szAlarmInCode[IVS_ALARM_CODE_LEN + 1] = {0};
	 IVS_CHAR szDomainCode[IVS_DOMAIN_CODE_LEN + 1] = {0};
	 IVS_INT32 iRet = CXmlProcess::ParseDevCode(pElemValue, szAlarmInCode, szDomainCode);
	 xml.ModifyElemValue(szAlarmInCode);
	 return iRet;
 }
//对XML中的设备编码拼装与编码
int CSDKMainctrl::ModifyDevCode(CXml& xml, IVS_CHAR* pData)const
{
	CHECK_POINTER(pData, IVS_OPERATE_MEMORY_ERROR);

	if (!xml.Parse(pData))
	{
		BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.Parse(pData)", "NA");
		//IVS_DELETE(pData, MUILI);
		return IVS_SMU_XML_INVALID;
	}
	if (!xml.FindElemEx("Content/Action"))
	{
		BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(Content/Action)", "NA");
		//IVS_DELETE(pData, MUILI);
		return IVS_SMU_XML_INVALID;		
	}
	// 若xml包含DevList,需要处理DevCode(拼接设备所在域编码DevDomainCode)
	if (xml.FindElem("DevList"))
	{
		xml.IntoElem();
		if (!xml.FindElem("DevInfo"))
		{
			BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(DevInfo)", "NA");
			//IVS_DELETE(pData, MUILI);
			return IVS_SMU_XML_INVALID;		
		}
		do 
		{
			(void)xml.IntoElem();
			// 找到设备所在域编码拼在DevCode后面
			if (!xml.FindElem("DevDomainCode"))
			{
				BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(DevCode)", "NA");
				//IVS_DELETE(pData, MUILI);
				return IVS_SMU_XML_INVALID;		
			}
			std::string strDevDomainCode;
            const IVS_CHAR* pDevDomainCode = xml.GetElemValue();
            if (NULL != pDevDomainCode)
            {
                strDevDomainCode = pDevDomainCode;
            }
			// 拼接设备所在域编码
			if (!xml.FindElem("DevCode"))
			{
				BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(DevCode)", "NA");
				//IVS_DELETE(pData, MUILI);
				return IVS_SMU_XML_INVALID;		
			}
			std::string strDevCode;
            
            const IVS_CHAR* pDevCode = xml.GetElemValue();
            if (NULL != pDevCode)
            {
                strDevCode = pDevCode;
            }

			if (!strDevCode.empty())
			{
				strDevCode.append("#").append(strDevDomainCode);
				xml.ModifyElemValue(strDevCode.c_str());
			}
			xml.OutOfElem();
		} while (xml.NextElem());
		xml.OutOfElem();
	}
// 
// 	IVS_UINT32 uiXmlLen = 0;
// 	pDataXml = xml.GetXMLStream(uiXmlLen);
// 	CHECK_POINTER(pDataXml, IVS_OPERATE_MEMORY_ERROR);
	return IVS_SUCCEED;
}//lint !e818
IVS_INT32 CDomainRouteMgr::GetShareCatalogList(const IVS_CHAR* pQueryInfo, IVS_CHAR** pRspXml)
{
    CHECK_POINTER(m_pUserMgr, IVS_OPERATE_MEMORY_ERROR);
	if (NULL == pQueryInfo)
	{
		BP_RUN_LOG_ERR(IVS_FAIL, "Get Share Cata log List", "Query Info is NULL");
		return IVS_FAIL;
	}
    // 获取本域SMU连接
    std::string strSMULinkID;
    IVS_INT32 iGetLinkRet = m_pUserMgr->GetLocalDomainLinkID(NET_ELE_SMU_NSS, strSMULinkID);
    if (IVS_SUCCEED != iGetLinkRet)
    {
        BP_RUN_LOG_ERR(iGetLinkRet, "Get LocalDomainLinkID failed", "NA");
        return iGetLinkRet;
    }
	CCmd* pCmd = CNSSOperator::instance().BuildSMUCmd(NSS_GET_SHARE_CATALOG_LIST_REQ, pQueryInfo, strSMULinkID);
	CHECK_POINTER(pCmd, IVS_OPERATE_MEMORY_ERROR);
	//发送消息
	IVS_INT32 iRet = IVS_FAIL;
	CCmd *pCmdRsp = CNSSOperator::instance().SendSyncCmd(pCmd);
	CHECK_POINTER(pCmdRsp, IVS_NET_RECV_TIMEOUT);
	const char* pBefore =  CNSSOperator::instance().ParseCmd2XML(pCmdRsp, iRet);
	if (IVS_SUCCEED != iRet || NULL == pBefore)
	{
		HW_DELETE(pCmdRsp);
		BP_RUN_LOG_ERR(iRet, "Share Cata log list", "XML illegal ");
		return iRet;
	}
	HW_DELETE(pCmdRsp);
	std::string strBefore = pBefore;
	IVS_DELETE(pBefore, MUILI);
	//std::string strBefore("<Content><ShareDevList><ShareDevInfo><OriginDevCode>123456</OriginDevCode><OriginDomainCode>0123456789</OriginDomainCode><LocalDevCode>0123#001</LocalDevCode></ShareDevInfo></ShareDevList></Content>");
	//std::string strBefore("<OriginDevCode>00000010000000000301</OriginDevCode><OriginDomainCode>001</OriginDomainCode><Latitude>0</Latitude><OriginDevCode>00000010000000000201#001</OriginDevCode><OriginDomainCode>001</OriginDomainCode><LocalDevCode /><Latitude>0</Latitude><OriginDevCode>00000010000000000101#001</OriginDevCode><OriginDomainCode>001</OriginDomainCode><OriginDevCode>1</OriginDevCode><OriginDomainCode /><LocalDevCode />");
	std::string strAfter;
	iRet = ComplicationDevDomainCode(strBefore,strAfter);

	CXml xml;
	std::string strDomainCode;
	m_pUserMgr->GetDomainCode(strDomainCode);
	std::string strLocalDevCode;
	if (!xml.Parse(strAfter.c_str()))
	{
		BP_RUN_LOG_ERR(IVS_OPERATE_MEMORY_ERROR, "xml.Parse(strAfter) fail", "NA");
		return IVS_OPERATE_MEMORY_ERROR;
	}
	if (!xml.FindElemEx("Content/ShareDevList"))
	{
		BP_RUN_LOG_ERR(IVS_SMU_DEV_REQ_XML_INVALID, "xml.FindElemEx(Content/ShareDevList) fail", "NA");
		return IVS_SMU_DEV_REQ_XML_INVALID;
	}
	if (!xml.FindElem("ShareDevInfo"))
	{
		IVS_UINT32 uiXmlLen = 0;
		const IVS_CHAR* pRsp = xml.GetXMLStream(uiXmlLen);
        if (NULL == pRsp)
        {
            return IVS_SMU_DEV_REQ_XML_INVALID;
        }

		IVS_CHAR *cTmp = IVS_NEW(cTmp,strlen(pRsp) + 1);
		if (NULL == cTmp)
		{
			return IVS_ALLOC_MEMORY_ERROR;
		}
		memset(cTmp, 0, strlen(pRsp) + 1);
		memcpy(cTmp, pRsp, strlen(pRsp));
		*pRspXml = cTmp;
		return IVS_SUCCEED;
	}
	do 
	{
		(void)xml.IntoElem();
		if (!xml.FindElem("LocalDevCode"))
		{
			BP_RUN_LOG_ERR(IVS_SMU_DEV_REQ_XML_INVALID, "xml.FindElem(LocalDevCode) fail", "NA");
			return IVS_SMU_DEV_REQ_XML_INVALID;
		}
        const IVS_CHAR* pLocalDevCode =  xml.GetElemValue();
        if (NULL != pLocalDevCode)
        {
            strLocalDevCode = pLocalDevCode;
        }

		if (0 != strcmp(strLocalDevCode.c_str(), ""))
		{
			strLocalDevCode.append("#");
			strLocalDevCode.append(strDomainCode);
			xml.ModifyElemValue(strLocalDevCode.c_str());
		}
		xml.OutOfElem();
	} while (xml.NextElem());

	IVS_UINT32 uiLen = 0;
	const IVS_CHAR* pRsq = xml.GetXMLStream(uiLen);

    if (NULL == pRsq)
    {
        return IVS_SMU_DEV_REQ_XML_INVALID;
    }

	IVS_CHAR *cTmp = IVS_NEW(cTmp,strlen(pRsq) + 1);
	if (NULL == cTmp)
	{
		return IVS_ALLOC_MEMORY_ERROR;
	}
	memset(cTmp, 0, strlen(pRsq) + 1);
	memcpy(cTmp, pRsq, strlen(pRsq));
	*pRspXml = cTmp;

	return iRet;
}//lint !e1762