vendredi 20 septembre 2019

After valid the data how to get data from xml file?

I write a program , and i used the (regex) operation and the valid a xml pattern ... but after validate how to store the data from the xml file and how to grab data from the xml file, i can not implement this please help me..... i will share the code!!!!!!!!!!!!!!!!!!!!!!!!!!

#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;
    }else{
        cout << "String are not match" << 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;

    return 0;
}




Aucun commentaire:

Enregistrer un commentaire