xml booster returns junk character in C structure after parsing

trioh

New Member
I am using a simple xml file. \[code\]<COMPANY> <EMPLOYEES> <EMPLOYEE> <NAME>BOB</NAME> <EMPID>51211</EMPID> <SEX>M</SEX> <DOB>10-1-1982</DOB> <DOJ>12-7-2001</DOJ> </EMPLOYEE> </EMPLOYEES></COMPANY>\[/code\]The xml booster meta definition file for the same is as below\[code\] <SYSTEM NAME="testmeta" > <CCONFIG MAXLEN="100" ARRAYSIZE="5" FLATMODE="TRUE"/> <ELEMENT NAME="COMPANY" TAG="COMPANY" MAIN="TRUE" > <FIELDS> <FIELD NAME="EMPLOYEES" REFTYPE="EMPLOYEE" MODE="DEFAULT" /> </FIELDS> <FORMULA> <ENCLOSED NAME="EMPLOYEES" > <META NAME="COMMENT" >Target field is EMPLOYEES</META> <REPEAT TARGET="EMPLOYEES" ATLEASTONE="TRUE" > <ELEMENTREF NAME="EMPLOYEE" /> </REPEAT> </ENCLOSED> </FORMULA> </ELEMENT> <ELEMENT NAME="EMPLOYEE" TAG="EMPLOYEE" > <FIELDS> <FIELD NAME="NAME" TYPE="STRING" /> <FIELD NAME="EMPID" TYPE="INTEGER" /> <FIELD NAME="SEX" TYPE="STRING" /> <FIELD NAME="DOB" TYPE="STRING" /> <FIELD NAME="DOJ" TYPE="STRING" /> </FIELDS> <FORMULA> <CONCAT> <ENCLOSED NAME="NAME" > <META NAME="COMMENT" >Target field is NAME</META> <PCDATA TARGET="NAME" /> </ENCLOSED> <ENCLOSED NAME="EMPID" > <META NAME="COMMENT" >Target field is EMPID</META> <PCDATA TARGET="EMPID" /> </ENCLOSED> <ENCLOSED NAME="SEX" > <META NAME="COMMENT" >Target field is SEX</META> <PCDATA TARGET="SEX" /> </ENCLOSED> <ENCLOSED NAME="DOB" > <META NAME="COMMENT" >Target field is DOB</META> <PCDATA TARGET="DOB" /> </ENCLOSED> <ENCLOSED NAME="DOJ" > <META NAME="COMMENT" >Target field is DOJ</META> <PCDATA TARGET="DOJ" /> </ENCLOSED> </CONCAT> </FORMULA> </ELEMENT></SYSTEM>\[/code\]Generated a .c and .h file for the same using xmlbooster lite using following command\[code\]xmlblit.exe -C testmeta.xmlb\[/code\]Now in my application in \[code\]main\[/code\] function i m calling \[code\]accept_COMPANY\[/code\] function and passing \[code\]S_XMLB_CONTEXT\[/code\] context object. Function succeeds but when i print each employee value using \[code\] printf("%s, %d, %s, %s, %s", En->aNAME, En->aEMPID, En->aSEX, En->aDOB, En->aDOJ); printf("\n");\[/code\]i am getting junk characters printed, even for the integer \[code\]aEMPID\[/code\] value. I am using Visual studio 2010 to compile and run the C program. Tried both Unicode and MultiByte project but no luck in getting the correct values.What am i doing wrong in the example? Kindly guide me. P.S: sorry for such a long question
 
Back
Top