secureswitools/swisistools/source/xmlparser/xmlparser.cpp
changeset 64 48c14c385b0e
parent 55 ac7f90a6ff4c
child 75 2d2d25361590
equal deleted inserted replaced
58:67f2119dc623 64:48c14c385b0e
    27 #include "xmlparser.h"
    27 #include "xmlparser.h"
    28 #include "logs.h"
    28 #include "logs.h"
    29 #include "exception.h"
    29 #include "exception.h"
    30 #include "utf8_wrapper.h"
    30 #include "utf8_wrapper.h"
    31 #include "util.h"
    31 #include "util.h"
       
    32 #include "utility.h"
    32 
    33 
    33 #include <xercesc/sax2/XMLReaderFactory.hpp>
    34 #include <xercesc/sax2/XMLReaderFactory.hpp>
    34 #include <xercesc/sax2/DefaultHandler.hpp>
    35 #include <xercesc/sax2/DefaultHandler.hpp>
    35 #include <xercesc/util/XMLString.hpp>
    36 #include <xercesc/util/XMLString.hpp>
    36 #include <xercesc/util/PlatformUtils.hpp>
    37 #include <xercesc/util/PlatformUtils.hpp>
   892 		XmlDetails::TScrPreProvisionDetail::TApplicationRegistrationInfo::TOpaqueDataType opaqueDataType = GetOpaqueDataType(currentOpaqueData);
   893 		XmlDetails::TScrPreProvisionDetail::TApplicationRegistrationInfo::TOpaqueDataType opaqueDataType = GetOpaqueDataType(currentOpaqueData);
   893 
   894 
   894 		appProperty.iLocale = opaqueDataType.iLocale;
   895 		appProperty.iLocale = opaqueDataType.iLocale;
   895 		appProperty.iName = L"OpaqueData";
   896 		appProperty.iName = L"OpaqueData";
   896 		appProperty.iIntValue = 0;
   897 		appProperty.iIntValue = 0;
   897 		appProperty.iIsStr8Bit = opaqueDataType.iIsBinary;
   898 		appProperty.iIsStr8Bit = true;
   898 		appProperty.iServiceUid = 0;
   899 		appProperty.iServiceUid = 0;
   899 		appProperty.iStrValue = opaqueDataType.iOpaqueData;
   900 
       
   901 		if(opaqueDataType.iIsBinary == 1)
       
   902 		{
       
   903 			std::string str = wstring2string(opaqueDataType.iOpaqueData);
       
   904 			std::string decodedString = Util::Base64Decode(str);
       
   905 			int len = decodedString.length();
       
   906 			appProperty.iStrValue.assign(decodedString.c_str(),decodedString.c_str()+len);
       
   907 		}
       
   908 		else
       
   909 		{
       
   910 			appProperty.iStrValue = opaqueDataType.iOpaqueData;
       
   911 		}
   900 		
   912 		
   901 		appRegistrationInfo.iApplicationProperty.push_back(appProperty);
   913 		appRegistrationInfo.iApplicationProperty.push_back(appProperty);
   902 		}
   914 		}
   903 
   915 
   904 	// for each FileOwnershipInfo retrieve all tags
   916 	// for each FileOwnershipInfo retrieve all tags
  1142 		XmlDetails::TScrPreProvisionDetail::TApplicationRegistrationInfo::TOpaqueDataType opaqueDataType = GetServiceOpaqueDataType(currentOpaqueData);
  1154 		XmlDetails::TScrPreProvisionDetail::TApplicationRegistrationInfo::TOpaqueDataType opaqueDataType = GetServiceOpaqueDataType(currentOpaqueData);
  1143 
  1155 
  1144 		appProperty.iLocale = opaqueDataType.iLocale;
  1156 		appProperty.iLocale = opaqueDataType.iLocale;
  1145 		appProperty.iName = L"OpaqueData";
  1157 		appProperty.iName = L"OpaqueData";
  1146 		appProperty.iIntValue = 0;
  1158 		appProperty.iIntValue = 0;
  1147 		appProperty.iIsStr8Bit = opaqueDataType.iIsBinary;
  1159 		appProperty.iIsStr8Bit = true;
  1148 		appProperty.iServiceUid = appServiceInfo.iUid;
  1160 		appProperty.iServiceUid = appServiceInfo.iUid;
  1149 		appProperty.iStrValue = opaqueDataType.iOpaqueData;
  1161 		if(opaqueDataType.iIsBinary == 1)
  1150 		
  1162 		{
       
  1163 			std::string str = wstring2string(opaqueDataType.iOpaqueData);
       
  1164 			std::string decodedString = Util::Base64Decode(str);
       
  1165 			appProperty.iStrValue = string2wstring(decodedString);
       
  1166 		}
       
  1167 		else
       
  1168 		{
       
  1169 			appProperty.iStrValue = opaqueDataType.iOpaqueData;
       
  1170 		}
  1151 		aAppRegistrationInfo.iApplicationProperty.push_back(appProperty);
  1171 		aAppRegistrationInfo.iApplicationProperty.push_back(appProperty);
  1152 		}
  1172 		}
  1153 
  1173 
  1154 	// for each DataType retrieve all tags
  1174 	// for each DataType retrieve all tags
  1155 	for( XMLSize_t index = 0; index < dataTypeCount; ++index )
  1175 	for( XMLSize_t index = 0; index < dataTypeCount; ++index )
  1373 	if( name->getLength() != 0)
  1393 	if( name->getLength() != 0)
  1374 		{
  1394 		{
  1375 		const XMLCh* nam = name->item(0)->getTextContent();
  1395 		const XMLCh* nam = name->item(0)->getTextContent();
  1376 		appProperty.iName = XMLChToWString(nam);
  1396 		appProperty.iName = XMLChToWString(nam);
  1377 		}
  1397 		}
  1378 	
  1398 
  1379 	if( intvalue->getLength() != 0)
  1399 	if( intvalue->getLength() != 0)
  1380 		{
  1400 		{
  1381 		const XMLCh* intval = intvalue->item(0)->getTextContent();
  1401 		const XMLCh* intval = intvalue->item(0)->getTextContent();
  1382 		appProperty.iIntValue = XercesStringToInteger(intval);
  1402 		appProperty.iIntValue = XercesStringToInteger(intval);
  1383 		}
  1403 		}
  1384 
  1404 	else if( strvalue->getLength() != 0)
  1385 	if( strvalue->getLength() != 0)
       
  1386 		{
  1405 		{
  1387 		const XMLCh* strval = strvalue->item(0)->getTextContent();
  1406 		const XMLCh* strval = strvalue->item(0)->getTextContent();
  1388 		appProperty.iStrValue = XMLChToWString(strval);
  1407 		appProperty.iStrValue = XMLChToWString(strval);
  1389 		}
  1408 		}
       
  1409 
       
  1410 	appProperty.iIsStr8Bit = false;
       
  1411 	
  1390 	LOGEXIT("CScrXmlParser::GetAppProperty()");
  1412 	LOGEXIT("CScrXmlParser::GetAppProperty()");
  1391 	return appProperty;
  1413 	return appProperty;
  1392 	}
  1414 	}
  1393 
  1415 
  1394 void CScrXmlParser::ConfigDomParser(xercesc::XercesDOMParser& aDomParser)
  1416 void CScrXmlParser::ConfigDomParser(xercesc::XercesDOMParser& aDomParser)