Exemple #1
0
BOOL CWizXmlRpcArrayValue::Read(CWizXMLNode& nodeValue)
{
	CWizXMLNode nodeData;
	if (!nodeValue.FindNodeByPath(_T("array/data"), nodeData))
	{
		TOLOG(_T("Failed to get array data node!"));
		return FALSE;
	}
	//
    std::deque<CWizXMLNode> arrayValue;
	nodeData.GetAllChildNodes(arrayValue);
	//
    for (std::deque<CWizXMLNode>::iterator it = arrayValue.begin();
		it != arrayValue.end();
		it++)
	{
		CWizXMLNode& nodeElementValue = *it;
		//
		CWizXmlRpcValue* pElementValue = NULL;
		if (!WizXmlRpcValueFromXml(nodeElementValue, &pElementValue ))
		{
			TOLOG(_T("Failed to load array element value from node!"));
			return FALSE;
		}
		//
		ATLASSERT(pElementValue);
		//
		Add(pElementValue);
	}
	//
	return TRUE;
}
bool CWizXmlRpcArrayValue::Read(CWizXMLNode& nodeValue)
{
	CWizXMLNode nodeData;
    if (!nodeValue.FindNodeByPath("array/data", nodeData))
	{
        TOLOG("Failed to get array data node!");
        return false;
	}

    std::deque<CWizXMLNode> arrayValue;
	nodeData.GetAllChildNodes(arrayValue);

    std::deque<CWizXMLNode>::iterator it;
    for (it = arrayValue.begin(); it != arrayValue.end(); it++)
	{
		CWizXMLNode& nodeElementValue = *it;

		CWizXmlRpcValue* pElementValue = NULL;
        if (!WizXmlRpcValueFromXml(nodeElementValue, &pElementValue))
		{
            TOLOG("Failed to load array element value from node!");
            return false;
		}

        Q_ASSERT(pElementValue);
		Add(pElementValue);
	}

    return true;
}
Exemple #3
0
bool WizXmlRpcResultFromXml(CWizXMLDocument& doc, CWizXmlRpcValue** ppRet)
{
	CWizXMLNode nodeMethodResponse;
    doc.FindChildNode("methodResponse", nodeMethodResponse);
    if (nodeMethodResponse.isNull())
	{
        TOLOG("Failed to get methodResponse node!");
        return false;
	}

	CWizXMLNode nodeTest;
	if (!nodeMethodResponse.GetFirstChildNode(nodeTest))
	{
        TOLOG("Failed to get methodResponse child node!");
        return false;
	}

	CString strTestName = nodeTest.GetName();

    if (0 == strTestName.CompareNoCase("params"))
	{
		CWizXMLNode nodeParamValue;
        nodeTest.FindNodeByPath("param/value", nodeParamValue);
        if (nodeParamValue.isNull())
		{
            TOLOG("Failed to get param value node of params!");
            return false;
		}

		return WizXmlRpcValueFromXml(nodeParamValue, ppRet);
	}
    else if (0 == strTestName.CompareNoCase("fault"))
	{
		CWizXMLNode nodeFaultValue;
		nodeTest.FindChildNode(_T("value"), nodeFaultValue);
        if (nodeFaultValue.isNull())
		{
            TOLOG("Failed to get fault value node!");
            return false;
		}

		CWizXmlRpcFaultValue* pFault = new CWizXmlRpcFaultValue();
		pFault->Read(nodeFaultValue);

		*ppRet = pFault;

        return true;
	}
	else
	{
        TOLOG1("Unknown response node name: %1", strTestName);
        return false;
	}
}