.net - Parsing XML with c++ code -
im .net developer , have modify simple c++ code.
the code fragment this:
rval = cmgetreportelement("../statuscode",buffer,1024); if(rval==0) { dvaresponse->statuscode = gcnew string(buffer); int32::tryparse(dvaresponse->statuscode,functionreturnval); } return functionreturnval;
it parsing xml statuscode (see below) , think failing (i cant debug it)
<?xml version="1.0" encoding="utf-16"?> <transmissionresponse xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <statuscode>3002</statuscode> </transmissionresponse>
can give me fail safe way status code out of xml
i not know c++ @ please no pseudocode
the cpp equivalent of :
regex regex = new regex("<tag1>(.*)</tag1>"); var v = regex.match("morenonxmldata<tag1>0002</tag1>morenonxmldata"); string s = v.groups[1].tostring();
i have made attempt , appreciate feedback
regex^ regex = gcnew regex("<statuscode>(.*)</statuscode>"); match^ match = regex->match(gcnew string(buffer)); string^ statuscode = match->groups[1]->value; int32::tryparse(statuscode,functionreturnval);
Comments
Post a Comment