ULXR_API_IMPL(CppString) MethodCall::getXml(int indent) const { CppString ind = getXmlIndent(indent); CppString ind1 = getXmlIndent(indent+1); CppString ind2 = getXmlIndent(indent+2); CppString s = ULXR_PCHAR("<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\"?>") + getXmlLinefeed(); s += ind + ULXR_PCHAR("<request command =\"") + methodname + ULXR_PCHAR("\">") +getXmlLinefeed(); s += ind1 + ULXR_PCHAR("<parameters>") + getXmlLinefeed(); for (std::vector<Value>::const_iterator it = params.begin(); it != params.end(); ++it) { //s += ind2 + ULXR_PCHAR("<param>") + getXmlLinefeed(); s += (*it).getXml(indent+3) + getXmlLinefeed(); //s += ind2 + ULXR_PCHAR("</param>") + getXmlLinefeed(); } s += ind1 + ULXR_PCHAR("</parameters>") + getXmlLinefeed(); s += ind + ULXR_PCHAR("</request>"); return s; }
std::string MethodCall::getXml(int indent) const { std::string ind = getXmlIndent(indent); std::string ind1 = getXmlIndent(indent+1); std::string ind2 = getXmlIndent(indent+2); std::string s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + getXmlLinefeed(); s += ind + "<methodCall>" + getXmlLinefeed(); s += ind1 + "<methodName>"+methodname+"</methodName>" + getXmlLinefeed(); s += ind1 + "<params>" + getXmlLinefeed(); for (std::vector<Value>::const_iterator it = params.begin(); it != params.end(); ++it) { s += ind2 + "<param>" + getXmlLinefeed(); s += (*it).getXml(indent+3) + getXmlLinefeed(); s += ind2 + "</param>" + getXmlLinefeed(); } s += ind1 + "</params>" + getXmlLinefeed(); s += ind + "</methodCall>"; return s; }