Esempio n. 1
0
static void parseCase(const char* const xmlFile)
{
    //
    //  Create our SAX handler object and install it on the parser, as the
    //  document and error handler.
    //
    if (!handler)
        handler = new XSerializerHandlers();

    BinOutputStream* myOut = new BinMemOutputStream(BufSize);
    Janitor<BinOutputStream> janOut(myOut);

    if (!parseOne(myOut, xmlFile))
        return;

    BinInputStream*  myIn  = new BinMemInputStream(
                                                   ((BinMemOutputStream*)myOut)->getRawBuffer()
                                                 , ((BinMemOutputStream*)myOut)->getSize()
                                                 , BinMemInputStream::BufOpt_Reference
                                                  );
    Janitor<BinInputStream> janIn(myIn);

    parseTwo(myIn, xmlFile);

}
Esempio n. 2
0
int main()
{
	cJSON *rootOne = cJSON_CreateObject();
	createOne(rootOne);
	char * jsonStr = cJSON_Print(rootOne);
	printf("jsonStr is %s\n",jsonStr);
	//free(jsonStr);
	parseOne(jsonStr);
	printf("+++++++++++++++++++++++++++++++\n");
	cJSON *rootTwo= cJSON_CreateObject();
	createTwo(rootTwo);
	jsonStr = cJSON_Print(rootTwo);
	printf("jsonStr is %s\n",jsonStr);
	parseTwo(jsonStr);

	return 0;
}