int OTSignedFile::ProcessXMLNode(irr::io::IrrXMLReader*& xml) { int nReturnVal = 0; // Here we call the parent class first. // If the node is found there, or there is some error, // then we just return either way. But if it comes back // as '0', then nothing happened, and we'll continue executing. // // -- Note you can choose not to call the parent if // you don't want to use any of those xml tags. // As I do below, in the case of OTAccount. //if (nReturnVal = OTContract::ProcessXMLNode(xml)) // return nReturnVal; if (!strcmp("signedFile", xml->getNodeName())) { m_strVersion = xml->getAttributeValue("version"); m_strPurportedLocalDir = xml->getAttributeValue("localDir"); m_strPurportedFilename = xml->getAttributeValue("filename"); // --------------------- nReturnVal = 1; } else if (!strcmp("filePayload", xml->getNodeName())) { // go to the next node and read the text. xml->read(); if (EXN_TEXT == xml->getNodeType()) { OTString strNodeData = xml->getNodeData(); // Sometimes the XML reads up the data with a prepended newline. // This screws up my own objects which expect a consistent in/out // So I'm checking here for that prepended newline, and removing it. char cNewline; if (strNodeData.At(0, cNewline)) { OTASCIIArmor ascNodeData; if ('\n' == cNewline) { ascNodeData.Set(strNodeData.Get() + 1); ascNodeData.GetString(m_strSignedFilePayload, true); // linebreaks = true } else { ascNodeData.Set(strNodeData.Get()); ascNodeData.GetString(m_strSignedFilePayload, true); // linebreaks = true } } } else { fprintf(stderr, "Error in OTSignedFile::ProcessXMLNode: filePayload field without value.\n"); return (-1); // error condition } return 1; } return nReturnVal; }