int TDDVRMessage::LoadXml(char* xml)
{
XercesDOMParser *parser = new XercesDOMParser;
const char* gMemBufId = "prodInfo";
int errorCode=0;
MemBufInputSource* memBufIS = new MemBufInputSource
(
(const XMLByte*)xml
, strlen(xml)
, gMemBufId
, false
);
try
{
parser->parse(*memBufIS);
DOMDocument* doc=parser->getDocument();
DOMNode *dvr=doc->getFirstChild();
DOMNode *info=dvr->getFirstChild();
const XMLCh* a=info->getNodeName();
DOMNamedNodeMap* map=info->getAttributes();
DOMNode* temInfo=map->getNamedItem(X("IP"));
this->IP(XMLString::transcode(temInfo->getTextContent()));
temInfo=map->getNamedItem(X("ID"));
this->ID(ToInt32(XMLString::transcode(temInfo->getTextContent())));
temInfo=map->getNamedItem(X("UserName"));
this->UserName(XMLString::transcode(temInfo->getTextContent()));
temInfo=map->getNamedItem(X("PWS"));
this->PWS(XMLString::transcode(temInfo->getTextContent()));
temInfo=map->getNamedItem(X("Port"));
this->Port(ToInt32(XMLString::transcode(temInfo->getTextContent())));
temInfo=map->getNamedItem(X("ChannelIndex"));
this->ChannelIndex(ToInt32(XMLString::transcode(temInfo->getTextContent())));
int x=0;
}
catch (const OutOfMemoryException&)
{
XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
errorCode = 5;
}
catch (const XMLException& e)
{
errorCode = 4;
}
if(errorCode) {
XMLPlatformUtils::Terminate();
return errorCode;
}
return errorCode;
}
{
XercesDOMParser *parser = new XercesDOMParser;
const char* gMemBufId = "prodInfo";
int errorCode=0;
MemBufInputSource* memBufIS = new MemBufInputSource
(
(const XMLByte*)xml
, strlen(xml)
, gMemBufId
, false
);
try
{
parser->parse(*memBufIS);
DOMDocument* doc=parser->getDocument();
DOMNode *dvr=doc->getFirstChild();
DOMNode *info=dvr->getFirstChild();
const XMLCh* a=info->getNodeName();
DOMNamedNodeMap* map=info->getAttributes();
DOMNode* temInfo=map->getNamedItem(X("IP"));
this->IP(XMLString::transcode(temInfo->getTextContent()));
temInfo=map->getNamedItem(X("ID"));
this->ID(ToInt32(XMLString::transcode(temInfo->getTextContent())));
temInfo=map->getNamedItem(X("UserName"));
this->UserName(XMLString::transcode(temInfo->getTextContent()));
temInfo=map->getNamedItem(X("PWS"));
this->PWS(XMLString::transcode(temInfo->getTextContent()));
temInfo=map->getNamedItem(X("Port"));
this->Port(ToInt32(XMLString::transcode(temInfo->getTextContent())));
temInfo=map->getNamedItem(X("ChannelIndex"));
this->ChannelIndex(ToInt32(XMLString::transcode(temInfo->getTextContent())));
int x=0;
}
catch (const OutOfMemoryException&)
{
XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
errorCode = 5;
}
catch (const XMLException& e)
{
errorCode = 4;
}
if(errorCode) {
XMLPlatformUtils::Terminate();
return errorCode;
}
return errorCode;
}