我编写了一个程序,我使用了(正则表达式)操作和有效的 xml 模式......但是在验证了如何从字符串中存储数据并将其存储到 xml 文件中以及如何从 xml 文件中获取数据之后,我无法实现这个请帮帮我.....我会分享代码!!!!!!!!!!!!!!!!!!!!!!!!!!!我的问题是,如果我在 if 块中输入 cofr,代码不起作用???如何解决
#include <iostream>
#include <regex>
#include "tinyxml2.h"
using namespace std;
int main()
{
string a = "\x01msvc-server\x1Cmsvc-xyzy4\x02<?xml version=\"1.0\" encoding=\"UTF-8\"?><SVCMessage currency=\"INR\" hostName=\"msvc-xyz4\" language=\"US-en\" retransmit=\"N\" sequence=\"00\" timeout=\"90\" version=\"8\"><Amount>0.01</Amount><BusinessDate>20190506</BusinessDate><CheckNumber>0</CheckNumber><LocalDate>20170506</LocalDate><LocalTime>160722</LocalTime><RequestCode>POINT_REDEMPTION</RequestCode><RevenueCenter>0</RevenueCenter><TerminalID>21</TerminalID><TraceID>190506860722N000000</TraceID><Track2>1161111112</Track2><TransactionEmployee>0</TransactionEmployee></SVCMessage>\x03\x04";
// Here b is object of regex- Regular Expression
regex b("(.*)\\x01([A-Za-z0-9_-]*)\\x1C([A-Za-z0-9_-]*)\\x02([^\\x00-\\x1F\\x7F]*)\\x03\\x04(.*)");
if( regex_match(a, b)){
cout << "String is matches Reguler Expreation " << endl;
//cout<< a << endl;
tinyxml2::XMLDocument xmlDoc;
tinyxml2::XMLError eResult = xmlDoc.LoadFile("regex.xml");
if(eResult != tinyxml2::XML_SUCCESS)
return false;
else
std::cout<< "Load File in New Document" << std::endl;
}else{
cout << "String are not match" << endl;
}
return 0;
}